Crypto plaintext padding

David Clymer david at zettazebra.com
Sun May 6 11:39:33 EDT 2007


I'm using pycrypto's AES module, and am attempting to automate the
padding of the plaintext (the size of the text to be encrypted must be a
multiple of 16). However, my padding scheme sometimes fails to calculate
the necessary padding correctly, and I'm not sure why.

Using the text 'foo bar', it fails, but if I do 'foo bars' it works.
Randomized testing fails sometimes and not others.

Any pointers as to what I might be doing wrong (code attached)?

-davidc

-- 
gpg-key: http://www.zettazebra.com/files/key.gpg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: text/x-python
Size: 3135 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20070506/6a30f192/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20070506/6a30f192/attachment.sig>


More information about the Python-list mailing list