Use a small common knowledge

 

A method on the string to binary data

method:

b'hello '     and   ' hello'.encode ( 'utf-8'  )  the same function

Import hashlib 

MD = hashlib.md5 ()   # generate a ciphertext objects made 
Val = ' la la '    # salt treatment 
md.update (val.encode ( ' UTF-. 8 ' )) 

# md.update ( ' hello'.encode ( 'utf-8') ) # string into binary form 
md.update (B ' Hello ' )   # Bytes type is binary form, b'hello 'and' hello'.encode ( 'utf 8 ') is the same as the role of 

RES = md.hexdigest ()
 Print (RES)

 

Guess you like

Origin www.cnblogs.com/qinsungui921112/p/11322442.html
Recommended