giving garbage value while trying to store a md5 hash in a file in python

Posted by mekasperasky on Stack Overflow See other posts from Stack Overflow or by mekasperasky
Published on 2010-05-04T16:09:46Z Indexed on 2010/05/04 16:18 UTC
Read the original article Hit count: 170

Filed under:
m=md5.new() 
a=10111011
>>> m.update(str(a))
>>> k=m.digest()
>>> k
'\xec\x9d1\x89e\x08\xa1\xc2Y\xf6\xbf6\xfe\xe4\xe2M'
>>> f.write(str(k))
>>> f.flush()

the file f is filled with garbage value which i cant use to read again for further use of the hash . Why does it give the garbage value when on the python terminal it gives proper output?And the worst part is file goes corrupt ..

© Stack Overflow or respective owner

Related posts about python