On 01/20/10 22:23, Steven D'Aprano wrote:

I'm writing a module that handles, I won't call it encryption,
obfuscation using classical cryptographic algorithms. One of the
functions needs a deterministic but unpredictable integer generated from
a human-generated password or passphrase, so I'm using:

hashlib.md5(key).digest()

to get a string of bytes, then converting it to an int.

int.from_bytes would be perfect for me, but in the meantime I'm using
Paul Rubin's trick of int(s.encode("hex"), 16).


Sorry, but this doesn't work for me (in Python 3.2a0)
since hashlib.md5(key).digest() returns a byte string
which has no .encode method.

Just my 5 cents,
Helmut.


--
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to