rodrigosantosbr

[Py] Creating secure hashes

Feb 14th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

The ‘hashlib’ module supports a plethora of secure hash algorithms including SHA1, SHA224, SHA256, SHA384, SHA512 and MD5.

import hashlib
txt = "MI6 Classified Information 007"
h1 = hashlib.sha1(txt.encode('utf-8')).hexdigest()
print(h1)
h2 = hashlib.sha224(txt.encode('utf-8')).hexdigest()
print(h2)
h3 = hashlib.sha256(txt.encode('utf-8')).hexdigest()
print(h3)
h4 = hashlib.sha384(txt.encode('utf-8')).hexdigest()
print(h4)
h5 = hashlib.sha512(txt.encode('utf-8')).hexdigest()
print(h5)
h6 = hashlib.md5(txt.encode('utf-8')).hexdigest()
print(h6)
Add Comment
Please, Sign In to add comment