diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-07-05 14:28:17 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-07-05 14:28:17 +0200 |
| commit | 4f58d99e11e1c412a600f39f32a8d181765f0246 (patch) | |
| tree | 7bd7b860ab8e60105e37c873d134b2d59842b21e /src/add_python/lilliput/ae_common.py | |
| parent | 904b99b495a419fefc666e489c31893f86d5080e (diff) | |
| parent | da895e90ec0db658ce9ebbfe60591c7e88f9d6a3 (diff) | |
| download | lilliput-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.py | 10 |
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 |
