From d6164fddbb09f0dc5248b341e97610957f80f8f8 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Mon, 25 Mar 2019 09:45:24 +0100 Subject: [implem-python] Suppression de variables intermédiaires MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le code résultant ressemble plus à ce qui est décrit dans les algorithmes 3 et 4. --- src/add_python/lilliput/ae_mode_2.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/add_python/lilliput') diff --git a/src/add_python/lilliput/ae_mode_2.py b/src/add_python/lilliput/ae_mode_2.py index a486bc9..2349757 100644 --- a/src/add_python/lilliput/ae_mode_2.py +++ b/src/add_python/lilliput/ae_mode_2.py @@ -69,8 +69,7 @@ def _message_auth_tag(M, N, Auth, key): if need_padding: tweak = _tweak_tag(l, True) - m_padded = pad10(M[l]) - encryption = tbc.encrypt(tweak, key, m_padded) + encryption = tbc.encrypt(tweak, key, pad10(M[l])) tag = xor(tag, encryption) tweak = N + [0b00010000] @@ -89,14 +88,12 @@ def _message_encryption(M, N, tag, key): for j in range(0, l): tweak = _add_tag_j(tag, j) - padded_nonce = N + [0b00000000] - encryption = tbc.encrypt(tweak, key, padded_nonce) + encryption = tbc.encrypt(tweak, key, N+[0b00000000]) C.append(xor(M[j], encryption)) if need_padding: tweak = _add_tag_j(tag, l) - padded_nonce = N + [0b00000000] - encryption = tbc.encrypt(tweak, key, padded_nonce) + encryption = tbc.encrypt(tweak, key, N+[0b00000000]) C.append(xor(M[l], encryption)) return C -- cgit v1.2.3