import hashlib
# MD5加密
def jiamimd5(src):
m = hashlib.md5()
m.update(src.encode('UTF-8'))
return m.hexdigest()
=====================================
import time
print(time.time) # 获取时间戳,浮点型
stam = int(time.time) # 转整形
priint(stam) #得到时间戳
================================
import hmac i
mport hashlib
appkey = "需要申请"
strToSign = "根据文档规则生成"
# hmac_sha256加密
signature = hmac.new(bytes(appkey, encoding='utf-8'), bytes(strToSign, encoding='utf-8'), digestmod=hashlib.sha256).digest()
# print(signature)
# 二进制转为
HEX HEX = signature.hex()
# print(HEX)
# 将字符串换为小写
lowsigne = HEX.lower()