Pycrypto

Laszlo Nagy gandalf at designaproduct.biz
Fri Jun 16 09:38:48 EDT 2006


> Not in this implementation:
> py> from Crypto.Cipher import AES
> py> crypt = AES.new('abcdefghijklmnop', AES.MODE_CBC)
> py> c = crypt.encrypt('1')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ValueError: Input strings must be a multiple of 16 in length
>   
This is strange. In theory, any ECB mode cipher can be used to create a 
CBC mode cipher.
AFAIK, CBC creates one encrypted  block, and uses the one byte from the 
plain text to xor it
with the last encrypted byte. Finally it shifts the encrypted block. 
This way each input byte will
have a corresponding output byte, and there is no size limit for the 
plain text.

Frankly, I could write the CBC mode cipher using the (already existing) 
ECB cipher. Why we have this limitation?

  Laszlo





More information about the Python-list mailing list