Your Linux Data Center Experts

With Python 3.3, a set of my patches were accepted to enhance the crypt library and make strong password hashing easy. Just call “crypt.crypt()” with the password and the result will be a salted hash. You can then use that salted hash with “crypt.crypt()” to check the password again in the future:

>>> import crypt
>>> salted_hash = crypt.crypt('foo')
>>> len(salted_hash) 
106
>>> crypt.crypt('foo', salted_hash) == salted_hash
True
>>> crypt.crypt('bar', salted_hash) == salted_hash
False

More information is available in the crypt module documentation

comments powered by Disqus

Join our other satisfied clients. Contact us today.