Abstract 1:MD5
Import hashlibmd5 = Hashlib.md5 () print (MD5) print (Md5.update (' How to use MD5 in Python hashlib? '). Encode (' Utf-8 ')) print (Md5.hexdigest ())
run Result:
<md5 HASH Object @ 0x7fac5fae0f80>noned26a53750bc40b38b65a520292f69306
Abstract 2:SHA1
IMPORT&NBSP;HASHLIBSHA1&NBSP;=&NBSP;HASHLIB.SHA1 () sha1.update (' how to use sha1 in '). Encode (' Utf-8 ')) sha1.update (' Python hashlib? '). Encode (' Utf-8 ')) print (Sha1.hexdigest ())
Operation Result:
2c76b57293ce30acef38d98f6046927161b46a44
Add Salt: salt
This is a custom algorithm.
The same string can get the same MD5 value, in order to strengthen the guard, you can use: Password + user's account name + fixed custom string, and then encryption,
In this way, the obtained MD5 value is unique, making the crack more difficult.
Python Digest (hashing algorithm): Hashlib