def test_qqtea_encrypt_n(n): seed(114514) for i in range(32): key, text = randbytes(16), randbytes(n) assert pyqqtea_encrypt(text, key) == qqtea_encrypt(text, key), f"in round {i}"
def test_pyqqtea_decrypt4096(benchmark): key, text = b"\xff" * 16, b"\xff" * 4096 cipher_text = pyqqtea_encrypt(text, key) def func(key, cipher_text): pyqqtea_decrypt(cipher_text, key) benchmark(func, key, cipher_text)
def test_qqtea_mixed_n(n): seed(114514) for i in range(32): key, text = randbytes(16), randbytes(n) cipher_text = qqtea_encrypt(text, key) assert pyqqtea_decrypt(cipher_text, key) == qqtea_decrypt(cipher_text, key), f"in round {i}" cipher_text = pyqqtea_encrypt(text, key) assert pyqqtea_decrypt(cipher_text, key) == qqtea_decrypt(cipher_text, key), f"in round {i}"
def func(key, text): pyqqtea_encrypt(text, key)