import hashlib m = hashlib.md5()#实例化 # bytes passwd = 'NHY_*&^_1982343532' # passwd.encode() #把字符串转成bytes类型 m.update(passwd.encode()) #不能直接对字符串加密,要先把字符串转成bytes类型 print(m.hexdigest()) #md5加密是不可逆 #撞库 # befor after # nhy123 81fb61ce98e508df8dbe8da07ad9acfc def my_md5(str): import hashlib new_str = str.encode() #把字符串转成bytes类型 # new_str = b'%s'%str #把字符串转成bytes类型 m = hashlib.md5() #实例化md5对象 m.update(new_str) #加密 return m.hexdigest() #获取结果返回 # hashlib.sha512
加密
猜你喜欢
转载自www.cnblogs.com/hwtfamily/p/8982827.html
今日推荐
周排行