python添加MD5加密

#!/usr/bin/env python
# -*-coding:utf-8-*-
# author:BeeLu
import hashlib
# params = "name=jjjjjj&access_token=2FBFRSTvkbJd3ZthPzAh0oZcPBhC16Qi"

params = ""
access_token='******'
data = {

}
for i in data:
params += i + "=" + data[i] + '&' # 循环取data的数据并&连接起来
params = params + "access_token=" + access_token
key_sign = hashlib.md5(params.encode(encoding="utf-8")).hexdigest() # md5加密,有中文要改变encode
print(key_sign)
posted @ 2020-05-09 13:15  书院小先生  阅读(335)  评论(0编辑  收藏  举报