From f5e853d28bb41079721180af5a860a6ee5a9d970 Mon Sep 17 00:00:00 2001 From: fsssosei <43291778+fsssosei@users.noreply.github.com> Date: Sun, 8 Aug 2021 20:50:50 +0800 Subject: [PATCH] Update hpc.py Fixed not running a stir when key length is 0 --- hpc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hpc.py b/hpc.py index 1f653ad..b80aa11 100644 --- a/hpc.py +++ b/hpc.py @@ -120,7 +120,7 @@ def create_kx_table(key, sub_cipher_num, key_len, backup=0): cleaned_key = hex_str_to_arr(key) # Incorporating the content of the key into key expansion table - for j in range(math.ceil(len(cleaned_key)/128)): + for j in range(max(math.ceil(len(cleaned_key)/128), 1)): for i in range(min(len(cleaned_key)-128*j, 128)): kx[i] = m_xor(kx[i], cleaned_key[i+j*128]) _stir(kx, backup)