Cryptographic Module Hashlib
ImportHASHLIBM=hashlib.md5 () m.update (b'Hello')Print(M.hexdigest ())#Hex EncryptionM.update (b' World')Print(M.hexdigest ())#The encryption of this is (b (' HelloWorld '))#5d41402abc4b2a76b9719d911017c592#fc5e038d38a57032085441e7fe7010b0s=hashlib.md5 () s.update (b'HelloWorld')Print(S.hexdigest ())#the second value is equal to the third value#In addition to the MD5 encryption method, there are other encryption sha1,sha224,sha256,sha384,sha512p=hashlib.sha256 () p.update ('Hello World'. Encode (encoding='Utf-8'))Print(P.hexdigest ())#usage with MD5Cryptographic Module Hashlib
HMAC message encryption, faster, double-layer encryption
# HMAC message encryption, faster, double-layer encryption Import HMACD=hmac.new (b'nihao',' holiday '. Encode ( encoding='utf-8')print(d.hexdigest () ) Print(D.digest ())
HMAC Message Encryption
Python:hashlib Encryption Module