import hashlib
plaintext_str = 'abcdef'
# 创建md5实例化对象
obj = hashlib.md5()
# 写入要加密的字节
obj.update(plaintext_str.encode("utf-8"))
# 获取密文
ciphertext_str = obj.hexdigest()
print('明文:%s 转换成密文:%s'%(plaintext_str, ciphertext_str))
"""
执行结果:
明文:abcdef 转换成密文:e80b5017098950fc58aad83c8c14978e
"""
02-25
1593
02-24
1万+