mincrypt.py 文件源码

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

项目:andcrypter 作者: alexbarcelo 项目源码 文件源码
def encrypt_key(key, password):
    """Encrypt the given key through the provided password.

    :param bytes key: The 16 bytes key for the volume.
    :param bytes password: The password (in bytes form) provided by the user.
    """
    salt = os.urandom(16)
    key_opener = hashlib.pbkdf2_hmac('sha256', password, salt, 100000, dklen=16)
    key_encrypted = bytes(a ^ b for a, b in zip(key, key_opener))

    return salt, key_encrypted
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号