#hashlib module Hash Algorithm#for cryptographic related operations, 3.x replaces the MD5 module and the SHA module, mainly provides SHA1, SHA224, SHA256 (Common), SHA384, SHA512, MD5 algorithmImportHashlib#MD5 algorithm, no inverse solutionobj =hashlib.md5 () obj.update ('Admin'. Encode ('Utf-8'))#obj.update (' admin '. Encode (' Utf-8 '))#obj.update (' root '. Encode (' Utf-8 '))#performing the above two steps is equivalent to Obj.update (' Adminroot '. Encode (' Utf-8 '))Print(Obj.hexdigest ())#Although the above encryption algorithm is still very strong, but the time there is a flaw, namely: through the pool can be reversed#Therefore, it is necessary to add a custom key to the encryption algorithm to do encryption. obj = hashlib.md5 (' Custom key '. Encode (' Utf-8 '))#SHA256 AlgorithmHash= hashlib.sha256 ('898oafs09f'. Encode ('UTF8'))#the user-defined key is added here.Hash.update ('Alvin'. Encode ('UTF8'))Print(Hash.hexdigest ())
Hashlib Module Hash Algorithm