Since there is a hashlib module, it can be easily implemented. I wrote in the title that it has salt, but it's also easy because you can add "Salt + Data" to hashlib.
!/usr/bin/env python
import hashlib
message = "salt" + "data"
print "MD5: " + hashlib.md5(message).hexdigest()
print "sha256: " + hashlib.sha256(message).hexdigest()
print "sha516: " + hashlib.sha512(message).hexdigest()
~~~~~~~
Here, md5, sha256, and sha516 are used.
#### ·Verification
./hash.py MD5: 23eeeb4347bdd26bfc6b7e ・ ・ ・ sha256: 11a4a60b518bf24989d481468076e5d59828846265b857 ・ ・ ・ sha516: ecc579811643b170cbd88fd0d0e323d1e1acc7cef8f73483a7 ・ ・ ・
Since the output is long and difficult to see due to line breaks, I omitted it with "...".
It's actually longer (especially sha512)
Recommended Posts