17 lines
460 B
Python
17 lines
460 B
Python
|
import time
|
|||
|
import uuid
|
|||
|
import hashlib
|
|||
|
def timeset():
|
|||
|
# <20><>ȡ<EFBFBD><C8A1>ǰʱ<C7B0><CAB1><EFBFBD><EFBFBD>
|
|||
|
time_stamp = int(time.time())
|
|||
|
# <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
nonce = str(uuid.uuid4())
|
|||
|
# Ӧ<><D3A6><EFBFBD><EFBFBD>Կ
|
|||
|
app_secret = "8ff611f60e6e4413804379108b617f"
|
|||
|
# <20><><EFBFBD><EFBFBD>ԭʼ<D4AD><CABC>
|
|||
|
SIGN_TEMPLATE = "time:{},nonce:{},appSecret:{}".format(time_stamp, nonce, app_secret)
|
|||
|
# <20><><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9>
|
|||
|
sign = hashlib.md5(SIGN_TEMPLATE.encode()).hexdigest()
|
|||
|
print("sign:", sign)
|
|||
|
return time_stamp,nonce,sign
|