[PYTHON-CRYPTO] Doing modes in Python

Andrew Archibald aarchiba at YAHOO.COM
Fri Apr 27 07:30:39 CEST 2001

On Thu, Apr 26, 2001 at 06:07:12PM -0700, Bram Cohen wrote:

> Also, I'd like to point you all to the documentation of cbccts.py, which
> documents some of the significant caveats that even this simple API to one
> of the most straightforward modes has. It demonstrates what a mess trying
> to finalize the API for modes now would be. CBC is only ankle-deep in tar,
> some of the others are into it up to their belly button.

Ah, to illustrate your point, I think that the way you're encrypting
short packets is not the only way to do it.  A more consistent way
would be to steal bits from the IV (although this requires changing
the IV).

I would say, though, that the standard modes are just that: standard.
ECB, CBC (without stealing), n-bit CFB, OFB and Counter mode are all
pretty standard, and they cover enough of the bases to be worth
implementing in C.  (You can also, for example, implement ciphertext
stealing efficiently given only CBC and ECB mode).


More information about the python-crypto mailing list