Python SHA-based encryption function, new version

Paul Rubin phr-n2002a at nightsong.com
Sun May 5 19:09:43 EDT 2002


I've uploaded a new version to: 
 
  http://www.nightsong.com/phr/crypto/p2.py

Please continue to post any comments/suggestions/bugs.

Changes in this version

- Message authentication is now encrypt-then-sign using standard SHA1
  HMAC, per suggestion of Bryan Olson and others.  The HMAC
  implementation in this file should be faster than the one that comes
  with Python 2.2.

- I make sure to change the cipher state before computing the nonce, 
  in case there's a thread switch between computing the nonce and
  folding the nonce into the new state.  Before computing the nonce
  I simply prepend an 'X' to the old state.  Anyone see any problems?

- Some minor optimizations and cosmetic changes.

I haven't yet added entry points to separately compute the nonce, run
the cipher, and sign a message, but probably ought to do so.  

This version does NOT interoperate with the old version, but I've kept
the filename the same, since they're all supposed to only be used for
testing and evaluation anyway.  When a final version is released, I'll
change to a new filename to avoid confusion.



More information about the Python-list mailing list