md5 question

D

Dan

I have a question regarding the md5 module. Is there a way in
"initialize" the md5 to a hex value, and continue processing with that
value.

For example:
In [13]:md5_h = md5.md5("Hello world")

In [14]:md5_h.hexdigest()
Out[14]:'3e25960a79dbc69b674cd4ec67a72c62'

In [15]:md5_w = md5.md5("Hello")

In [16]:md5_w.hexdigest()
Out[16]:'8b1a9953c4611296a827abf8c47804d7'

In [17]:md5_w.update(" world")

In [18]:md5_w.hexdigest()
Out[18]:'3e25960a79dbc69b674cd4ec67a72c62'

now pretend I wanted to save the string
'8b1a9953c4611296a827abf8c47804d7', and later create a new md5 object
such that when I did md5_w.update(" world") it would then have the hex
value '3e25960a79dbc69b674cd4ec67a72c62'. Is that possible? I've looked
for initialization options in the documentation and searched c.l.p.,
but no luck.

-Dan
 
D

Dan Sommers

now pretend I wanted to save the string
'8b1a9953c4611296a827abf8c47804d7', and later create a new md5 object
such that when I did md5_w.update(" world") it would then have the hex
value '3e25960a79dbc69b674cd4ec67a72c62'. Is that possible? I've looked
for initialization options in the documentation and searched c.l.p.,
but no luck.

According to http://docs.python.org/lib/module-md5.html, you want the
copy method of your existing md5 object.

Regards,
[Another] Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top