1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| import hashlib import hmac
def asha512(key, value):
hsobj = hashlib.sha3_512(key.encode("utf-8")) hsobj.update(value.encode("utf-8")) return hsobj.hexdigest()
def sha_jm(key,value): if not isinstance(key,bytes): key = bytes(key, 'utf-8') if not isinstance(value, bytes): value = bytes(value, 'utf-8') h = hmac.new(key, value, digestmod="SHA512") return h.hexdigest()
print(asha512('iLAgiklLN8QiklLN8QrLi4giLAgiklLN8QiklLN8QrLi4g','/api/search/searchmulti/api/search/searchmulti{"searchkey":"萨达萨达","pageindex":1,"pagesize":20}')) print(sha_jm('iLAgiklLN8QiklLN8QrLi4giLAgiklLN8QiklLN8QrLi4g','/api/search/searchmulti/api/search/searchmulti{"searchkey":"萨达萨达","pageindex":1,"pagesize":20}'))
|