initial commit

This commit is contained in:
2026-04-16 16:29:49 +02:00
commit f4f875ecde
6 changed files with 192 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
import pytest
from tea3 import Tea3
@pytest.mark.parametrize(
"frame, expected_iv",
[
(0x11111111, 0xD5111111112B6C40),
],
)
def test_compute_iv(frame, expected_iv):
assert Tea3.compute_iv(frame) == expected_iv
@pytest.mark.parametrize(
"key, frame, expected",
[
(
[0x00] * 10,
0x11111111,
[0x06, 0xA6, 0x58, 0x8C, 0x5D, 0x9A, 0x99, 0x6D, 0xD2, 0x5E],
),
(
[0xA7, 0x98, 0x39, 0xE4, 0xBA, 0x88, 0xEE, 0x54, 0xA0, 0x29],
0x01234567,
[0x02, 0x49, 0x1E, 0xF5, 0x57, 0xC5, 0x1C, 0x17, 0x73, 0x0C],
),
],
)
def test_known_vectors(key, frame, expected):
cipher = Tea3(frame, key)
assert cipher.keystream(len(expected)) == expected