Skip to content

Commit

Permalink
fix tests after rc2 eks change
Browse files Browse the repository at this point in the history
  • Loading branch information
huettenhain committed Sep 10, 2024
1 parent dd9c8af commit 7f8a905
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/units/crypto/cipher/test_custom_cipher_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def test_compatibility_decrypt(self):
key = b'refinery/testing'
for mode in CIPHER_MODES:
try:
E = -rc2(key, mode=mode, iv=B'refinery', raw=True)
E = -rc2(key, mode=mode, iv=B'refinery', raw=True, eks=128)
D = +jc2(key, mode=mode, iv=B'refinery', raw=True)
except ValueError:
continue
Expand All @@ -156,7 +156,7 @@ def test_compatibility_encrypt(self):
for mode in CIPHER_MODES:
try:
E = -jc2(key, mode=mode, iv=B'refinery', raw=True)
D = +rc2(key, mode=mode, iv=B'refinery', raw=True)
D = +rc2(key, mode=mode, iv=B'refinery', raw=True, eks=128)
except ValueError:
continue
M = self.generate_random_buffer(RC2.block_size * 20)
Expand All @@ -166,13 +166,13 @@ def test_compatibility_encrypt(self):
def test_ctr_mode(self):
key = b'testing/refinery'
E = -jc2(key, mode='ctr', iv=B'n0nc3', raw=True)
D = +rc2(key, mode='ctr', iv=B'n0nc3', raw=True)
D = +rc2(key, mode='ctr', iv=B'n0nc3', raw=True, eks=128)
M = self.generate_random_buffer(RC2.block_size * 20)
self.assertEqual(M, M | E | D | memoryview)

def test_kryptografie_de_rc2_example(self):
data = B'BeispielklartextBeispielklartext'
key = B'Schokoladentorte'
wish = bytes.fromhex('0969F22A 6E5BF195 E788759E 876521AF 0969F22A 6E5BF195 E788759E 876521AF')
self.assertEqual(bytes(data | -rc2(key, raw=True)), wish)
self.assertEqual(bytes(data | -rc2(key, raw=True, eks=128)), wish)
self.assertEqual(bytes(wish | +jc2(key, raw=True)), data)

0 comments on commit 7f8a905

Please sign in to comment.