summaryrefslogtreecommitdiff
path: root/python/constants.py
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2019-03-14 12:47:41 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2019-03-21 14:49:15 +0100
commitf161a41e1bb1b379335bb658877a8859a64c9d10 (patch)
tree763e94039894a154edfcf58602082ca6d3afb4b9 /python/constants.py
parent02eb0c9f257435595889d15577e4641b2242d0a1 (diff)
downloadlilliput-ae-implem-f161a41e1bb1b379335bb658877a8859a64c9d10.tar.xz
[implem-python] Suppression de paramètres redondants
tweak_bits est constant pour un mode donné ; rounds se déduit de la taille de clé.
Diffstat (limited to 'python/constants.py')
-rw-r--r--python/constants.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/constants.py b/python/constants.py
index acedfa7..94a3e0e 100644
--- a/python/constants.py
+++ b/python/constants.py
@@ -1,6 +1,15 @@
BLOCK_BYTES = 16
+def rounds(key_bits):
+ r = {
+ 128: 32,
+ 192: 36,
+ 256: 42
+ }
+ return r[key_bits]
+
+
Sbox = [32, 0, 178, 133, 59, 53, 166, 164,
48, 228, 106, 44, 255, 89, 226, 14,
248, 30, 122, 128, 21, 189, 62, 177,