summaryrefslogtreecommitdiff
path: root/python/lilliput_tbc.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/lilliput_tbc.py')
-rw-r--r--python/lilliput_tbc.py25
1 files changed, 4 insertions, 21 deletions
diff --git a/python/lilliput_tbc.py b/python/lilliput_tbc.py
index 0dbfb31..fbd1fb3 100644
--- a/python/lilliput_tbc.py
+++ b/python/lilliput_tbc.py
@@ -2,14 +2,8 @@
Lilliput TBC
"""
from constants import BLOCK_BYTES, Sbox
-import multiplications
+from multiplications import ALPHAS
-MultiplyM = multiplications.MultiplyM
-MultiplyM2 = multiplications.MultiplyM2
-MultiplyM3 = multiplications.MultiplyM3
-MultiplyMR = multiplications.MultiplyMR
-MultiplyMR2 = multiplications.MultiplyMR2
-MultiplyMR3 = multiplications.MultiplyMR3
permutation = [14, 11, 12, 10, 8, 9, 13, 15, 3, 1, 4, 5, 6, 0, 2, 7]
permutationInv = [13, 9, 14, 8, 10, 11, 12, 15, 4, 5, 3, 1, 2, 6 ,0 ,7]
@@ -27,22 +21,11 @@ def _lane(TK, j):
def RoundTweakeySchedule(tweakey) :
p = len(tweakey)//8
- # Multiplication
- alphas = (
- list, # Identity.
- MultiplyM,
- MultiplyM2,
- MultiplyM3,
- MultiplyMR,
- MultiplyMR2,
- MultiplyMR3
+ multiplied_lanes = (
+ ALPHAS[j](_lane(tweakey, j)) for j in range(p)
)
- return [
- byte
- for j in range(p)
- for byte in alphas[j](_lane(tweakey, j))
- ]
+ return [byte for lane in multiplied_lanes for byte in lane]
def SubTweakeyExtract(tweakey, Ci):