lilliput-ae-reference-implementation

Implementations of Lilliput-AE submitted to the NIST LWC standardization process
git clone https://git.kevinlegouguec.net/lilliput-ae-reference-implementation
Log | Files | Refs | README

commit 0d0ecee46d6e5d47ff390cbaa254bf0d560d504f
parent 07af965f2687105324e0142270a9e194a5ae6af5
Author: Kévin Le Gouguec <kevin.legouguec@airbus.com>
Date:   Mon, 25 Mar 2019 09:10:33 +0100

[implem-python] Ajustements de forme

Diffstat:
Msrc/add_python/lilliput/ae_common.py | 6+++++-
Msrc/add_python/lilliput/ae_mode_1.py | 4++--
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/add_python/lilliput/ae_common.py b/src/add_python/lilliput/ae_common.py @@ -51,8 +51,12 @@ def pad10(X): return zeroes + [0b10000000] + X +def integer_to_byte_array(i, n): + return list(i.to_bytes(n, 'little')) + + def _tweak_associated_data(t, i, padded): - tweak = list(i.to_bytes(t//8, 'little')) + tweak = integer_to_byte_array(i, t//8) prefix = 0b0110 if padded else 0b0010 diff --git a/src/add_python/lilliput/ae_mode_1.py b/src/add_python/lilliput/ae_mode_1.py @@ -87,7 +87,7 @@ def _treat_message_enc(M, N, key): tweak_final = _tweak_message(N, l+1, _MessageTweak.FINAL) Final = tbc.encrypt(tweak_final, key, checksum) - return (Final, C) + return Final, C def _treat_message_dec(C, N, key): @@ -119,7 +119,7 @@ def _treat_message_dec(C, N, key): tweak_final = _tweak_message(N, l+1, _MessageTweak.FINAL) Final = tbc.encrypt(tweak_final, key, checksum) - return (Final, M) + return Final, M def encrypt(A, M, N, key):