google-authenticator.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:google-authenticator 作者: grahammitchell 项目源码 文件源码
def get_hotp_token(secret, intervals_no):
    """This is where the magic happens."""
    key = base64.b32decode(normalize(secret), True) # True is to fold lower into uppercase
    msg = struct.pack(">Q", intervals_no)
    h = hmac.new(key, msg, hashlib.sha1).digest()
    o = ord(h[19]) & 15
    h = str((struct.unpack(">I", h[o:o+4])[0] & 0x7fffffff) % 1000000)
    return prefix0(h)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号