bottle.py 文件源码

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

项目:dabdabrevolution 作者: harryparkdotio 项目源码 文件源码
def cookie_decode(data, key, digestmod=None):
    """ Verify and decode an encoded string. Return an object or None."""
    depr(0, 13, "cookie_decode() will be removed soon.",
                "Do not use this API directly.")
    data = tob(data)
    if cookie_is_encoded(data):
        sig, msg = data.split(tob('?'), 1)
        digestmod = digestmod or hashlib.sha256
        hashed = hmac.new(tob(key), msg, digestmod=digestmod).digest()
        if _lscmp(sig[1:], base64.b64encode(hashed)):
            return pickle.loads(base64.b64decode(msg))
    return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号