summaryrefslogtreecommitdiff
path: root/src/add_python/lilliput/ae_common.py
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2019-07-05 14:28:17 +0200
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2019-07-05 14:28:17 +0200
commit4f58d99e11e1c412a600f39f32a8d181765f0246 (patch)
tree7bd7b860ab8e60105e37c873d134b2d59842b21e /src/add_python/lilliput/ae_common.py
parent904b99b495a419fefc666e489c31893f86d5080e (diff)
parentda895e90ec0db658ce9ebbfe60591c7e88f9d6a3 (diff)
downloadlilliput-ae-implem-4f58d99e11e1c412a600f39f32a8d181765f0246.tar.xz
Merge branch 'fix-concatenation'
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