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

Thorsten Behrens sbehrens at gmx.li
Wed Jan 12 14:59:38 CST 2011


Josh,

I've added Schneier's CBC test vector to our test suite. We succeed. 
Here's the vector as it looks in our code:

     # chaining mode (CBC) test data
     
(b('37363534333231204e6f77206973207468652074696d6520666f722000000000'),b('6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc'),b('0123456789abcdeff0e1d2c3b4a59687'),
         'Blowfish CBC mode test vector',
         dict(mode='CBC', iv=b('fedcba9876543210'))),

And here it is as presented by Schneier:

chaining mode test data
key[16]   = 0123456789ABCDEFF0E1D2C3B4A59687
iv[8]     = FEDCBA9876543210
data[29]  = "7654321 Now is the time for " (includes trailing '\0')
data[29]  = 37363534333231204E6F77206973207468652074696D6520666F722000
cbc cipher text
cipher[32]= 6B77B4D63006DEE605B156E27403979358DEB9E7154616D959F1652BD5FF92CC


He pads the data[29] with three more \0 at the end to get to 32.

Can you run that test vector against your library and see how it behaves?

Thorsten



More information about the pycrypto mailing list