[pycrypto] Base64 encoded output differs from pycrypto and as3crypto libraries.

Thorsten Behrens sbehrens at gmx.li
Wed Jan 12 14:04:00 CST 2011


Joshua,

"I82NQEkSHhE=" is the result I get. I've tested with Python 3.1, hence 
the b'' for the result string.

We use public test vectors to make sure our Blowfish encrypts correctly. 
Test vectors are from http://www.schneier.com/code/vectors.txt. We use 
ECB mode with the test vectors. It is entirely possible that we have an 
issue with CBC mode, I'll not rule it out right away.

Do you have a reference implementation handy that you can use to encrypt 
this and see what the results are?

 >>> from Crypto.Cipher import Blowfish
 >>> B = Blowfish.new( 'Thisisthekey', Blowfish.MODE_CBC, '30313233' )
 >>> S = 'testtest'
 >>> X = B.encrypt( S )
 >>> import base64
 >>> Y = base64.b64encode( X )
 >>> print (Y)
b'I82NQEkSHhE='
 >>> import binascii
 >>> Y = binascii.b2a_base64(X)
 >>> print (Y)
b'I82NQEkSHhE=\n'


Thorsten



More information about the pycrypto mailing list