Is it an MD5 digest in this Python script?

Posted by brilliant on Stack Overflow See other posts from Stack Overflow or by brilliant
Published on 2010-04-08T06:01:47Z Indexed on 2010/04/08 6:13 UTC
Read the original article Hit count: 472

Filed under:
|
|

Hello, I am trying to understand this simple hashlib code in Python that has been given to me the other day on "Stackoverflow":

import hashlib
m = hashlib.md5()
m.update("Nobody inspects")
m.update(" the spammish repetition here")
m.digest()
'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'
m.digest_size
16
m.block_size
64
print m

I thought that "print m" would show me the MD5 digest of the phrase: "Nobody inspects the spammish repetition here", but as a result I got this line on my local host:

<md5 HASH object @ 01806220>

Strange, when I refreshed the page, I got another line:

<md5 HASH object @ 018062E0>

and every time when I refresh it, I get another value:

md5 HASH object @ 017F8AE0

md5 HASH object @ 01806220

md5 HASH object @ 01806360

md5 HASH object @ 01806400

md5 HASH object @ 01806220

Why is it so? I guess, what I have in each line flowing "@" is not really a digest. Then, what is it? And how can I display MD5 digest here in this code?

My python version is Python 2.5 and the framework I am currently using is webapp (I have downloaded it together with SDK from "Google App Engine")

© Stack Overflow or respective owner

Related posts about digest

Related posts about md5