# 生成签名
def generate_sign(param): # param是字典dict
stringA = ''
ks = sorted(param.keys())
# 参数排序
for k in ks:
stringA += k + "=" + str(param[k]) + "&"
# 拼接商户KEY
stringSignTemp = stringA + "key=" + KEY
# md5加密
hash_md5 = hashlib.md5(stringSignTemp.encode('utf8'))
sign = hash_md5.hexdigest().upper()
print(sign)
return sign
python生成微信签名
最新推荐文章于 2024-09-14 15:52:10 发布