From 11a1e33e41858d87692a8b6d726d654e292455ec Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Thu, 14 Mar 2019 14:40:42 +0100 Subject: [implem-python] Déclaration de "alphas" dans multiplications.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/lilliput_tbc.py | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'python/lilliput_tbc.py') 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): -- cgit v1.2.3