utils.py 文件源码

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

项目:RKSV 作者: ztp-at 项目源码 文件源码
def aes256ctr(iv, key, data):
    """
    Encrypts the given data using AES-256 in CTR mode with the given IV and key.
    Can also be used for decryption due to how the CTR mode works.
    :param iv: The IV as a byte list.
    :param key: The key as a byte list.
    :param data: The data to be encrypted as a byte list.
    :return: The encrypted data as a byte list.
    """
    cipher = Cipher(algorithms.AES(key), modes.CTR(iv), backend = default_backend())
    encryptor = cipher.encryptor()
    return encryptor.update(data) + encryptor.finalize()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号