模块之Time,datatime,hashlib,hmac

邮差的信 提交于 2019-11-29 10:23:47

time模块

打印三种不同格式的时间

time.time()  # 打印当前时间(秒)

time.sleep()  # 睡眠

datetime模块

修改时间

datetime.datetime.now() + datetime.timedelta(3)

hashlib模块

加密

m = hashlib.md5()
m.update(b'hello')
m.update(b'hello')
print(m.hexdigest())


m = hashlib.md5()
m.update(b'hellohello')
print(m.hexdigest())
  1. 结果永远都是相同长度的字符串
  2. 叠加性

hmac模块

加密, 加盐处理

m = hmac.new(b'123')
m.update(b'hellow')
print(m.hexdigest())
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!