Python md5()加密
import hashlib#示例一
hash = hashlib.md5()
#将加密内容先用utf-8编码,防止“Unicode-objects must be encoding before hashing”错误
hash.update('admin'.encode('utf-8'))
print(hash.hexdigest())
#示例二
data = 'admin'
hash = hashlib.md5(data.encode('utf-8'))
print(hash.hexdigest())
页:
[1]