python MD5 operation

def my_md5(str):
    import hashlib
    new_str = str.encode() #Convert the string to bytes type 
    # new_str = b'%s'%str #Convert the string to bytes type 
    m = hashlib.md5() #Instantiate   the md5 object 
    m.update(new_str )   #encryption return m.hexdigest
     ()   #get the result and return 96e79218965eb72c92a549dd5a330112


 

Guess you like

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