[Baypiggies] Help Aes Implementation

Martin Falatic martin at falatic.com
Sun May 15 16:35:10 EDT 2016


To add to this, from what I can tell this script uses output feedback
mode. The original source of what you shared as "AES-1" and discussion can
be found here:

http://brandon.sternefamily.net/2007/06/aes-tutorial-python-implementation/

The initialization vector used by the script is random, so I set it to
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] for testing purposes (and compared that
to openssl with the same IV and using OFB mode. Still haven't had any luck
reproducing the operating mode of this script in such a way as to be able
to decrypt the output of one with the other.

The updated reference commands that would appear to match what the script
is meaning to do, even if it doesn't (note the password is "test" for the
purpose of testing):

openssl enc -aes-256-ofb -nosalt -pass pass:test -in a -out enc.bin -iv 00 -p
openssl enc -aes-256-ofb -nosalt -pass pass:test -d -in enc.bin -out b -iv
00 -p

Again, curious to see what you are comparing outputs against.

 - Marty


On Sat, May 14, 2016 21:49, Martin Falatic wrote:
> Do you require Python 2.5 to make these function? Because I just tried
> them and neither seems to work.
>
> openssl enc -aes-256-cbc -in a.pdf -out enc.bin openssl enc -aes-256-cbc
> -d -in enc.bin -out b.pdf
> AES-1.py -d enc.bin -o c1.pdf
> AES-2.py -d enc.bin -o c2.pdf
> sha256sum a.pdf b.pdf c1.pdf c2.pdf
>
> openssl works to encrypt (unsalted) to ciphertext and then decrypt the
> ciphertext. Neither of the two Python scripts you've provided seem to do
> that (though yes, their outputs do differ, neither is the original
> plaintext).
>
> So the first question is, what kind of plaintext and AES cipher and
> implementation are you benchmarking these two scripts against?
>
> - Marty
>
>
>
>
> On Sat, May 14, 2016 14:18, Pyhack Blog wrote:
>
>> Hi,
>>
>>
>>
>> I have two AES implementation programs:
>>
>>
>>
>> AES-1:    http://pastebin.com/TrQ5iaxc
>> AES-2: http://pastebin.com/mXRyprKL
>>
>>
>>
>> I have one binary file which is encrypted with some other AES program
>> and it is getting decrypted with AES-1 but not with AES-2. I have shared
>> both the programs link with you can someone please help me in
>> identifying where exactly AES-2 is wrong in implementation.
>>
>> Regards
>> PyHack
>>
>>
>>
>>
>> _______________________________________________
>> Baypiggies mailing list
>> Baypiggies at python.org
>> To change your subscription options or unsubscribe:
>> https://mail.python.org/mailman/listinfo/baypiggies
>>
>
>
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> https://mail.python.org/mailman/listinfo/baypiggies
>
>




More information about the Baypiggies mailing list