import hashlib
from time import time
from random import randint,sample

def hex5(value):
hex = hashlib.md5()
hex.update(value.encode('utf-8'))
return hex.hexdigest()

#生成1-9之间的5个随机数
action = "".join([str(randint(1,9)) for _ in range(5)])

#生成当前时间戳
tim = round(time())

#生成5个大写随机字母
randstr = "".join(sample([chr(_) for _ in range(65,91)],5))

3个参数拼接后进行MD5加密

value = action + str(tim) + randstr
hexs = hex5(value)

print(action,tim,randstr,hexs)


最后修改:2022 年 12 月 05 日
如果觉得我的文章对你有用,请随意赞赏