summaryrefslogtreecommitdiff
path: root/python/lilliput_ae_2.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/lilliput_ae_2.py')
-rw-r--r--python/lilliput_ae_2.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/python/lilliput_ae_2.py b/python/lilliput_ae_2.py
index 757088d..d333be2 100644
--- a/python/lilliput_ae_2.py
+++ b/python/lilliput_ae_2.py
@@ -3,6 +3,7 @@
"""
import lilliput_tbc as ltbc
+from constants import rounds
from helpers import ArrayToBlockbytesMatrix, BlockbytesMatrixToBytes
@@ -25,7 +26,7 @@ N_BITS = 120
N_BYTES = int(N_BITS / 8)
-def InitParameters(key_bits = 128, tweak_bits = 128, rounds = 32) :
+def InitParameters(key_bits) :
global KEY_BITS
global KEY_BYTES
global TWEAK_BITS
@@ -36,12 +37,10 @@ def InitParameters(key_bits = 128, tweak_bits = 128, rounds = 32) :
global ROUNDS
KEY_BITS = key_bits
- TWEAK_BITS = tweak_bits
TWEAKEY_BITS = KEY_BITS + TWEAK_BITS
LANES = int((TWEAKEY_BITS) / LANE_BITS)
- ROUNDS = rounds
+ ROUNDS = rounds(key_bits)
KEY_BYTES = int(KEY_BITS / 8)
- TWEAK_BYTES = int(TWEAK_BITS / 8)
TWEAKEY_BYTES = int(TWEAKEY_BITS / 8)
@@ -217,8 +216,8 @@ def MessageEncryption(M, N, tag, key) :
return C
################################################################################
-def SCT2Enc(A, M, N, key, tweak_bits, rounds) :
- InitParameters(len(key)*8, tweak_bits, rounds)
+def SCT2Enc(A, M, N, key) :
+ InitParameters(len(key)*8)
global A_BITS
global M_BITS
@@ -251,8 +250,8 @@ def SCT2Enc(A, M, N, key, tweak_bits, rounds) :
return BlockbytesMatrixToBytes(C), bytes(tag)
-def SCT2Dec(A, C, N, tag, key, tweak_bits, rounds) :
- InitParameters(len(key)*8, tweak_bits, rounds)
+def SCT2Dec(A, C, N, tag, key) :
+ InitParameters(len(key)*8)
global A_BITS
global M_BITS