pbkdf2.py 文件源码

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

项目:MCSManager-fsmodule 作者: Suwings 项目源码 文件源码
def pbkdf2(password, salt, iterations, dklen=0, digest=None):
        """
        Implements PBKDF2 using the stdlib. This is used in Python 2.7.8+ and 3.4+.

        HMAC+SHA256 is used as the default pseudo random function.

        As of 2014, 100,000 iterations was the recommended default which took
        100ms on a 2.7Ghz Intel i7 with an optimized implementation. This is
        probably the bare minimum for security given 1000 iterations was
        recommended in 2001.
        """
        if digest is None:
            digest = hashlib.sha1
        if not dklen:
            dklen = None
        password = bytes_(password)
        salt = bytes_(salt)
        return hashlib.pbkdf2_hmac(
            digest().name, password, salt, iterations, dklen)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号