python hashlib module
First, the hashlib module is mainly used for encryption, which provides sha1, sha224, sha256, sha384, sha512, and md5 algorithms. Commonly used md5 can complete the requirements.
One, use md5 ordinary encryption
import hashlib
m = hashlib.md5()
m.update (b'cnblog.com ')
print(m.hexdigest
Second, 2-time encryption is actually splicing the string to be encrypted for the first time and the string to be encrypted for the second time to do one encryption
import hashlib
m2 = hashlib.md5('www.'.encode('utf-8'))
m2.update('cnblogs.com'.encode('utf-8'))
print(m2.hexdigest())
or
import hashlib
m3 = hashlib.md5()
m3.update('www.'.encode('utf-8'))
m3.update('cnblogs.com'.encode('utf-8'))
print(m3.hexdigest())
Or directly splicing the 2-time encrypted string directly
import hashlib
m4 = hashlib.md5()
m4.update('wwwcnblogs.com'.encode('utf-8'))
print(m4.hexdigest())
Third, use other encryption algorithms, similar to md5, such as sha512
import hashlib
m5 = hashlib.sha512()
m5.update(b'www')
print(m5.hexdigest())