summaryrefslogtreecommitdiff
path: root/python/lilliput_ae_1.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/lilliput_ae_1.py')
-rw-r--r--python/lilliput_ae_1.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/python/lilliput_ae_1.py b/python/lilliput_ae_1.py
index 688148f..92cfa6e 100644
--- a/python/lilliput_ae_1.py
+++ b/python/lilliput_ae_1.py
@@ -3,7 +3,7 @@
"""
import lilliput_tbc as ltbc
-from constants import rounds
+from constants import NONCE_BYTES, rounds
from helpers import ArrayToBlockbytesMatrix, BlockbytesMatrixToBytes
@@ -22,8 +22,7 @@ TWEAKEY_BYTES = int(TWEAKEY_BITS / 8)
A_BITS = BLOCK_BITS
M_BITS = BLOCK_BITS
-N_BITS = 120
-N_BYTES = int(N_BITS / 8)
+
def InitParameters(key_bits) :
global KEY_BITS
@@ -131,12 +130,12 @@ def BuildAuth(A, key) :
def TweakMessage(N, j, null = 0, padded = 0, final_padded = 0) :
tweak = [0 for byte in range(0, TWEAK_BYTES)]
- for byte in range(N_BYTES - 1, -1, -1) :
- tweak[byte + (TWEAK_BYTES - N_BYTES)] |= (N[byte] & 0xf0) >> 4
- tweak[byte + (TWEAK_BYTES - N_BYTES - 1)] |= (N[byte] & 0x0f) << 4
+ for byte in range(NONCE_BYTES-1, -1, -1) :
+ tweak[byte + (TWEAK_BYTES-NONCE_BYTES)] |= (N[byte] & 0xf0) >> 4
+ tweak[byte + (TWEAK_BYTES-NONCE_BYTES-1)] |= (N[byte] & 0x0f) << 4
- tweak[TWEAK_BYTES - N_BYTES - 1] |= ((j >> 64) & 0xf)
- for byte in range(TWEAK_BYTES - N_BYTES - 2, -1, -1) :
+ tweak[TWEAK_BYTES-NONCE_BYTES-1] |= ((j >> 64) & 0xf)
+ for byte in range(TWEAK_BYTES-NONCE_BYTES-2, -1, -1) :
tweak[byte] = (j >> (8 * byte)) & 0xff
if null == 1 :