diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-14 14:40:42 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-21 14:49:15 +0100 |
| commit | 11a1e33e41858d87692a8b6d726d654e292455ec (patch) | |
| tree | dc280ea43c7f16a92db925479f544674f5104c18 /python/lilliput_tbc.py | |
| parent | dc5efdfce750c02d4f3c4b35d5137342002fd78d (diff) | |
| download | lilliput-ae-implem-11a1e33e41858d87692a8b6d726d654e292455ec.tar.xz | |
[implem-python] Déclaration de "alphas" dans multiplications.py
Diffstat (limited to 'python/lilliput_tbc.py')
| -rw-r--r-- | python/lilliput_tbc.py | 25 |
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): |
