python-hashlib encryption module

1  import hashlib
 2  def my_md5(str):
 3      bytes_pwd = str.encode() #Convert the string to bytes type 
4      m = hashlib.md5()# Instantiate the md5 object to encrypt the string, you must first encrypt the string Convert to bytes type
 5      m.update(bytes_pwd) #Encryption , cannot pass strings, only bytes type, binary 
6      return m.hexdigest() #Get the result and return 
7  print (my_md5( ' 12345455 ' ))

Its running code is as follows:

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325239618&siteId=291194637