New Python block cipher API, comments wanted

Paul Rubin phr-n2003b at NOSPAMnightsong.com
Mon Jan 27 19:16:19 EST 2003


I'd appreciate it if any Python cryptography buffs out there could
take a look at

   http://www.nightsong.com/phr/crypto/blockcipher.tgz

It's a proposed new API for using block ciphers in Python.  It's
loosely patterned after the Java cipher classes, but somewhat simpler
and maybe more Pythonic.  Basically it provides a low level "codebook"
layer that implements raw block ciphers like DES or AES, and a higher
level "modes of operation" layer that implements the standard FIPS
cipher modes (ECB, CBC, OFB, CFB, and CTR) by calling codebook
objects.  This improves on the PEP 272 approach since a cipher
implementer only has to implement the raw block encryption function,
and a library module then provides all the FIPS modes automatically.
PEP 272 requires each new cipher module to implement all FIPS modes
itself.

The file at the url above includes a reference implementation written
in Python and some preliminary docs.  There are some rough edges about
the whole thing, and the reference implementation may be buggy, so
don't use it for anything serious.  It's intended as a throwaway, for
reference and testing purposes.

My hope is to get some comments from the community, make any needed
changes to the API, then re-implement it in C (including AES and DES)
for inclusion in Python 2.3a2 which should be coming out pretty soon.
The hope is for Python to finally get real cryptography as part of its
standard library.

Thanks for any comments or suggestions.

Paul




More information about the Python-list mailing list