[pycrypto] [problem]There's difference between pycrypto to crypt a string and cryptoPP to crypt a string with AES by CFB mode.

Dwayne C. Litzenberger dlitz at dlitz.net
Mon Dec 28 02:32:23 CST 2009

On Mon, Dec 28, 2009 at 02:19:06PM +0800, ten speme wrote:
>I using cryptoPP to crypt a string with key:"aaaaaaaaaaaaaaa"
>,iv:"bbbbbbbbbbbbbbbb",data"abcdefghijklmnopqrstuvwxyz", and its encrypted
>string is [hex]"9FE673D419DD3256B6A206FE7004660F11BAFCE5B2106E2BA39A"

Please be careful when posting troubleshooting requests.  "aaaaaaaaaaaaaaa" 
is 15 bytes long, so it's impossible as an AES key.  Can you post example 
code that builds against cryptoPP (or uses pycryptopp) and produces this 

>by pycrypto , I also using the same key, vi, and data. but get difference
>All these using AES with CFB mode.

Which CFB mode are you talking about?  CFB is a family of modes.  You can 
have e.g. 1-bit CFB, 8-bit CFB, 64-bit CFB, 128-bit CFB, etc.  PyCrypto 
defaults to 8-bit CFB, I believe, but will accept any multiple of 8 bits.  
(It's set by the segment_size keyword argument to AES.new.)

Dwayne C. Litzenberger <dlitz at dlitz.net>
  Key-signing key   - 19E1 1FE8 B3CF F273 ED17  4A24 928C EC13 39C2 5CF7
  Annual key (2009) - C805 1746 397B 0202 2758  2821 58E0 894B 81D2 582E

More information about the pycrypto mailing list