summaryrefslogtreecommitdiff
path: root/src/add_python/lilliput/ae_common.py
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2019-06-14 09:08:43 +0200
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2019-07-05 11:16:58 +0200
commita8da992171ac09ccca931f9909f5b199042b2ea8 (patch)
tree652d202b1ad6a6569d1b3509c3a39a2496e2e8ca /src/add_python/lilliput/ae_common.py
parent2bf9ad6563dede03a321ab85ab00e45b7ff89e1f (diff)
downloadlilliput-ae-implem-a8da992171ac09ccca931f9909f5b199042b2ea8.tar.xz
Adaptation de l'implémentation Python
Diffstat (limited to 'src/add_python/lilliput/ae_common.py')
-rw-r--r--src/add_python/lilliput/ae_common.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/add_python/lilliput/ae_common.py b/src/add_python/lilliput/ae_common.py
index b94be1b..db14ec3 100644
--- a/src/add_python/lilliput/ae_common.py
+++ b/src/add_python/lilliput/ae_common.py
@@ -15,7 +15,7 @@
"""Helper functions used in both Lilliput-I and Lilliput-II."""
-from .constants import BLOCK_BITS, BLOCK_BYTES
+from .constants import BLOCK_BYTES
from .helpers import xor
from . import tbc
@@ -48,11 +48,11 @@ def block_matrix_to_bytes(matrix):
def pad10(X):
zeroes = [0] * (BLOCK_BYTES-len(X)-1)
- return zeroes + [0b10000000] + X
+ return X + [0b10000000] + zeroes
def integer_to_byte_array(i, n):
- return list(i.to_bytes(n, 'little'))
+ return list(i.to_bytes(n, 'big'))
def _tweak_associated_data(t, i, padded):
@@ -61,8 +61,8 @@ def _tweak_associated_data(t, i, padded):
prefix = 0b0110 if padded else 0b0010
# Clear upper 4 bits and set them to prefix.
- tweak[-1] &= 0b00001111
- tweak[-1] = prefix << 4
+ tweak[0] &= 0b00001111
+ tweak[0] |= prefix << 4
return tweak