# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. import binascii import math import struct from pathlib import Path from cryptography.hazmat.primitives.ciphers import Cipher, algorithms from tests.utils import load_nist_vectors BLOCK_SIZE = 64 MAX_COUNTER = 2**64 - 1 def encrypt( key: bytes, nonce: bytes, initial_block_counter: int, plaintext: bytes ) -> bytes: full_nonce = struct.pack("