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
commit75d7f59658539c699cdf9c7a3abdbead15aac199 (patch)
tree7bd7b860ab8e60105e37c873d134b2d59842b21e /src/add_python/lilliput/ae_common.py
parent3d4608aac686498fa6a84f71dee05dadfd057dc9 (diff)
parentc242f47057cd3fdeb4471655b4cbd8c870fcf597 (diff)
downloadlilliput-ae-implem-75d7f59658539c699cdf9c7a3abdbead15aac199.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