A, hash and md5
Hash, generally translated to do a "hash", also has a direct transliteration of "hash", that is, the arbitrary length input (also called pre-mapping, pre-image), through a hash algorithm, converted into a fixed-length output , the output is the hash value.
md5 is a method in hashlib module is used for encryption algorithm, note that he can not be decrypted.
Sample code:
Print (the hash ( " http://www.baidu.com " )) from hashlib Import MD5 Print (MD5 ( " http://www.baidu.com " .encode ( " UTF-. 8 " )). hexdigest () ) # randomly generated string of decimal digits of the hash # md5 generates a random string of hexadecimal string # hash is generated randomly, each generated values are not the same, just inside the md5 pass parameters are fixed , then the value is fixed
The results of the first run
4673448876608239062
Bfa89e563d9509fbc5c6503dd50faf2e
Second run results
-1689851367869688135
Bfa89e563d9509fbc5c6503dd50faf2e
A, hash and md5
Hash, generally translated to do a "hash", also has a direct transliteration of "hash", that is, the arbitrary length input (also called pre-mapping, pre-image), through a hash algorithm, converted into a fixed-length output , the output is the hash value.
md5 is a method in hashlib module is used for encryption algorithm, note that he can not be decrypted.
Sample code:
Print (the hash ( " http://www.baidu.com " )) from hashlib Import MD5 Print (MD5 ( " http://www.baidu.com " .encode ( " UTF-. 8 " )). hexdigest () ) # randomly generated string of decimal digits of the hash # md5 generates a random string of hexadecimal string # hash is generated randomly, each generated values are not the same, just inside the md5 pass parameters are fixed , then the value is fixed
The results of the first run
4673448876608239062
Bfa89e563d9509fbc5c6503dd50faf2e
Second run results
-1689851367869688135
Bfa89e563d9509fbc5c6503dd50faf2e