diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/add_python/lilliput/ae_mode_2.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/add_python/lilliput/ae_mode_2.py b/src/add_python/lilliput/ae_mode_2.py index bf09731..1878060 100644 --- a/src/add_python/lilliput/ae_mode_2.py +++ b/src/add_python/lilliput/ae_mode_2.py @@ -22,6 +22,7 @@ from .constants import BLOCK_BYTES from .ae_common import ( bytes_to_block_matrix, block_matrix_to_bytes, + integer_to_byte_array, build_auth, pad10, TagValidationError, @@ -48,15 +49,11 @@ def _tweak_tag(j, padded): def _add_tag_j(tag, j): - array_j = [0 for byte in range(0, TWEAK_BYTES)] - for byte in range(0, TWEAK_BYTES): - array_j[byte] = (j >> (byte * 8)) + array_j = integer_to_byte_array(j, TWEAK_BYTES) + tweak = xor(tag, array_j) + tweak[-1] |= 0b10000000 - xorr = xor(tag, array_j) - - xorr[TWEAK_BYTES - 1] |= 0x80 - - return xorr + return tweak def _message_auth_tag(M, N, Auth, key): |
