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

Legrandin gooksankoo at hoiptorrow.mailexpire.com
Wed Jan 12 15:15:18 CST 2011


>    var t_byAry:ByteArray = Hex.toArray( Hex.fromString( t_toEnc ) );
>    var t_key:ByteArray = Hex.toArray( Hex.fromString( 'Thisisthekey' ) );
>    var t_cbc:CBCMode = new CBCMode( new BlowFishKey( t_key ), new NullPad );
>    t_cbc.IV = Hex.toArray( '30313233' );
>    t_cbc.encrypt( t_byAry );
>    t_enc = Base64.encodeByteArray( t_byAry );      

>    >>> from Crypto.Cipher import Blowfish
>    >>> B = Blowfish.new( 'Thisisthekey', Blowfish.MODE_CBC, '30313233' )

Could it be that in you AS code your IV is 4 bytes (0x30,0x31,0x32,0x33)
which t_cbc.encrypt() silently pads, whereas in the python code it is 8
different bytes (0x33 for '3', 0x30 for '0', etc)?

Legrandin



More information about the pycrypto mailing list