converting data to hex

Peter Abel p-abel at t-online.de
Fri Jan 31 02:51:02 EST 2003


Mark Harrison <mh at pixar.com> wrote in message news:<Q0j_9.1511$Ir1.259 at newssvr16.news.prodigy.com>...
> warning: newbie alert!
> 
> I've got an md5 digest and would like to print it as
> a hex value, but I can't get the individual hex value
> formatted.  Can someone loan me a clue?
> 
> import md5
> d = md5.new("foo")
> for x in d.digest():
>     print "a", ("%02x" % x)  ## how do I convert x to int???
> 
> Many TIA!
> Mark

>>> md5_string='788acf0f5ce8813cbdbddf510b54fb6f'
>>> eval('0x'+md5_string)
160228096136631806570404481192208694127L
>>> 

Regards
Peter




More information about the Python-list mailing list