hashlib module (encryption module)

It used to encrypt the document

. 1  # the Author: CallMeV 
2  # DATE: 2019-11-10 
. 3  # Time: 18:24 
. 4  
. 5  Import hashlib
 . 6  
. 7 m = hashlib.md5 ()
 . 8  Print (m)
 . 9  
10 m.update ( ' I love you ' .encode ( ' UTF8 ' ))
 . 11  Print (m.hexdigest ())   # 81fbaa81762885ac3481fd4b416485e6 
12 is  
13 is m.update ( ' high round ' .encode ( ' UTF8 ' ))
14  Print (m.hexdigest ())   # 1febe137d2ae456b448d758dd46d4d48 
15  
16 M2 = hashlib.md5 ()
 17 m2.update ( ' I love you Gao Yuanyuan ' .encode ( ' utf8 ' ))
 18  Print (m2.hexdigest ()) # 1febe137d2ae456b448d758dd46d4d48 
19  
20 S = hashlib.sha256 ()
 21 s.update ( ' Gao Yuanyuan I love you ' .encode ( ' utf8 ' ))
 22  Print (s.hexdigest ()) #651ec0fe3a54345620351e819695bd1d3d340f3396dde5f13a2485a3f13289dd

 

Guess you like

Origin www.cnblogs.com/fly10086/p/11831270.html