Authenticated encryption with PyCrypto

Daniel millerdev at
Tue Jan 26 23:51:00 CET 2010

On Jan 26, 12:37 pm, "M.-A. Lemburg" <m... at> wrote:
> Note that your code has a padding bug: the decoder doesn't
> undo the padding. You're lucky though, since pickle will only
> read as much data as it needs and not complain about the extra
> data it finds.

Doesn't the last line in decrypt() do it?

    return data[:-ord(data[-1])]

Given, it's a bit cryptic... no pun intended :)

> > Also, slightly related, is there an easy way to get the sha/md5
> > deprecation warnings emitted by PyCrypto in Python 2.6 to go away?
> Yes: you silence them via the warnings module. I suppose that the
> latest version of PyCrypto fixes these warnings.

The version that gets installed by easy_install or pip (2.0.1) emits
those warnings. Is there a more recent version?

Thanks for the feedback.

~ Daniel

More information about the Python-list mailing list