summaryrefslogtreecommitdiff
path: root/python/multiplications.py
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2019-03-14 14:40:42 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2019-03-21 14:49:15 +0100
commit11a1e33e41858d87692a8b6d726d654e292455ec (patch)
treedc280ea43c7f16a92db925479f544674f5104c18 /python/multiplications.py
parentdc5efdfce750c02d4f3c4b35d5137342002fd78d (diff)
downloadlilliput-ae-implem-11a1e33e41858d87692a8b6d726d654e292455ec.tar.xz
[implem-python] Déclaration de "alphas" dans multiplications.py
Diffstat (limited to 'python/multiplications.py')
-rw-r--r--python/multiplications.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/python/multiplications.py b/python/multiplications.py
index e753c68..7babd50 100644
--- a/python/multiplications.py
+++ b/python/multiplications.py
@@ -1,6 +1,6 @@
# Multiply by matrix M
-def MultiplyM(lane) :
+def _multiplyM(lane) :
multiplied_lane = [lane[(byte-1) % 8] for byte in range(0, 8)]
multiplied_lane[2] ^= ((lane[6] << 2) & 0xff)
@@ -9,7 +9,7 @@ def MultiplyM(lane) :
return multiplied_lane
-def MultiplyM2(lane) :
+def _multiplyM2(lane) :
multiplied_lane = [lane[(byte-2) % 8] for byte in range(0, 8)]
multiplied_lane[2] ^= ((lane[5] << 2) & 0xff)
@@ -35,7 +35,7 @@ def MultiplyM2(lane) :
return multiplied_lane
-def MultiplyM3(lane) :
+def _multiplyM3(lane) :
multiplied_lane = [lane[(byte-3) % 8] for byte in range(0, 8)]
multiplied_lane[2] ^= ((lane[4] << 2) & 0xff) ^ ((lane[5] << 5) & 0xff)
@@ -86,7 +86,7 @@ def MultiplyM3(lane) :
return multiplied_lane
-def MultiplyMR(lane) :
+def _multiplyMR(lane) :
multiplied_lane = [lane[(byte+1) % 8] for byte in range(0, 8)]
multiplied_lane[2] ^= ((lane[4] >> 3) & 0xff)
@@ -96,7 +96,7 @@ def MultiplyMR(lane) :
return multiplied_lane
-def MultiplyMR2(lane) :
+def _multiplyMR2(lane) :
multiplied_lane = [lane[(byte+2) % 8] for byte in range(0, 8)]
multiplied_lane[1] ^= ((lane[4] >> 3) & 0xff)
@@ -120,7 +120,7 @@ def MultiplyMR2(lane) :
return multiplied_lane
-def MultiplyMR3(lane) :
+def _multiplyMR3(lane) :
multiplied_lane = [lane[(byte+3) % 8] for byte in range(0, 8)]
multiplied_lane[0] ^= ((lane[4] >> 3) & 0xff)
@@ -173,3 +173,14 @@ def MultiplyMR3(lane) :
multiplied_lane[2] ^= multi_mat_l3_m4 ^ multi_mat_l6_m1 ^ multi_mat_l7_m3
return multiplied_lane
+
+
+ALPHAS = (
+ list, # Identity.
+ _multiplyM,
+ _multiplyM2,
+ _multiplyM3,
+ _multiplyMR,
+ _multiplyMR2,
+ _multiplyMR3
+)