[PYTHON-CRYPTO] Hashing modules

Ng Pheng Siong ngps at POST1.COM
Sun Feb 11 09:54:06 CET 2001


On Sat, Feb 10, 2001 at 07:15:16PM +0100, Michael Ströder wrote:
> Andrew Kuchling wrote:
> > >>> from Crypto.Hash import MD5
> > >>> m = MD5.new()
> > >>> m.update('abc')
> > >>> m.digest()
> > '\220\001P\230<\322O\260\326\226?@}(\341\177r'
>
> Slightly different:
> >>> import Crypto
> >>> md5 = Crypto.getInstance('MD5')
> >>> md5.update('abc')
> >>> md5.digest()
> > '\220\001P\230<\322O\260\326\226?@}(\341\177r'

M2Crypto's:

>>> from M2Crypto.EVP import MessageDigest
>>> md5 = MessageDigest('md5')
>>> md5.update('abc')
>>> md5.digest()
'\220\001P\230<\322O\260\326\226?}(\341\177r'


> Also we should try to implement a Codec-like StreamWriter() /
> StreamReader() class for that like mentioned by M.-A. Lemburg on the
> (deprecated) eGroups list.

OpenSSL's stackable BIO interface is quite amenable to this.

Current M2Crypto has a BIO.CipherFilter, which provides a stream
reader/writer-like interface. The tests have not been written,
so the code probably won't work as is.

I am going to write a GUI password safe using BIO.CipherFilter.
(Scratching a personal itch here - I have too many similar but
different online passwords.)


Cheers.

--
Ng Pheng Siong <ngps at post1.com> * http://www.post1.com/home/ngps





More information about the python-crypto mailing list