[Zope] Generating unique keys
Oleg Broytmann
phd@sun.med.ru
Mon, 11 Oct 1999 12:11:09 +0400 (MSD)
On Mon, 11 Oct 1999, gtk wrote:
> But I digress.
>
> <dtml-var expr="md5er('ggdgfg')">
>
> ... works just as expected. The output is 8-bit garbage, though -- anyone
> know of a nice unpack or hex conversion function I can call to clean that up
> into a clean string?
This one was suggested by Guido few years ago:
s = m.digest()
return "%02x"*len(s) % tuple(map(ord, s))
Oleg.
----
Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/
Programmers don't die, they just GOSUB without RETURN.