md5 数据加密测试

学Python,用RPA

艺赛旗RPA2020.1版本 正在免费下载使用中,欢迎下载使用

www.i-search.com.cn/index.html?from=line1

#!/usr/bin/env Python3

-- coding: utf-8 --

@Software: PyCharm

@virtualenv:workon

@contact: [email protected]

@Desc:Code descripton

author = ‘未昔/AngelFate’
date = ‘2020/4/28 13:00’
import hashlib

test = “加密测试”

创建一个md5 对象

h1 = hashlib.md5()

此处必须声明encode

若写法为hl.update(str) 报错为: Unicode-objects must be encoded before hashing

h1.update(test.encode())
print(“加密前”, test)
print(“加密后”, h1.hexdigest())

加密前 加密测试
加密后 f447f32b28217406a6fb8772cdec471c

Process finished with exit code 0
md5 数据加密测试