码迷,mamicode.com
首页 > 编程语言 > 详细

Python之路——hmac模块

时间:2018-02-06 18:03:49      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:ini   nta   this   post   str   updating   alt   col   body   

 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模块

标签:ini   nta   this   post   str   updating   alt   col   body   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!