python md5, d.update(strParam).hexdigest() returns NoneType.=, why? -


>>> d = md5.new() >>> d.update('a').hexdigest() traceback (most recent call last):   file "<interactive input>", line 1, in <module> attributeerror: 'nonetype' object has no attribute 'hexdigest' 

this work -

>>> d = md5.new() >>> d.update('a') >>> d.hexdigest() '0cc175b9c0f1b6a831c399e269772661' 

is there explanation on shortening python code?

you want this:

import hashlib hashlib.md5('a').hexdigest() 

note: don't use plain md5 security.

  • if you're hashing passwords, use scrypt or bcrypt.
  • if you're authenticating message, use hmac.
  • if you're checking file integrity, consider sha2 or newer.

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -