首页 > 编程语言 > 详细

Python之路——hmac模块

时间:2018-02-06 17:52:04      阅读:270      评论:0      收藏:0      [点我收藏+]
 1 import hmac
 2 import os
 3 c = os.urandom(24)  # 返回一个随机的32字节的二进制数,可以应用于密码相关的方面
 4 name = bliuyk
 5 h = hmac.new(name,c)
 6 digest = h.digest() # This returns a string containing 8-bit data.  The object is
 7                     # not altered in any way by this function; you can continue
 8                     # updating the object after calling this function.
 9 h.update(bhahaha)
10 print(digest)
11 print(h.digest())
12 print(h.hexdigest(),len(h.hexdigest()))

 

Python之路——hmac模块

原文:https://www.cnblogs.com/liuyankui163/p/8423139.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!