Skip to content

Vectorized evaluator of cipher_partial_inverse is not working #338

@juaninf

Description

@juaninf

The following portion of code related to the vectorized evaluation of the inverse of last round of SpeckBlockCipher is not working. Even uncommenting the commented lines (due #337).

from claasp.ciphers.block_ciphers.speck_block_cipher import SpeckBlockCipher
import numpy as np

speck_cipher = SpeckBlockCipher(number_of_rounds=5)
speck_cipher_without_key_schedule = speck_cipher.remove_key_schedule()
partial_speck = speck_cipher_without_key_schedule.cipher_partial_inverse(4, 4, True)
#partial_speck.set_inputs(['cipher_output_4_12', 'key_4_2'], [32, 16])
#partial_speck.get_all_components()[-1]._description[0] = "cipher_output"
#del partial_speck._rounds.rounds[3]
#del partial_speck._rounds.rounds[2]
#del partial_speck._rounds.rounds[1]
#partial_speck._rounds.rounds[1]._id = 1
rng = np.random.default_rng(10)
plaintext = rng.integers(low=0, high=256, size=(4, 1), dtype=np.uint8)
key = rng.integers(low=0, high=256, size=(2, 1), dtype=np.uint8)
partial_speck.evaluate_vectorized([plaintext, key])

The error is

root@0bb99764eb4f:/home/sage/tii-claasp# python3 test3.py 
Traceback (most recent call last):
  File "/home/sage/tii-claasp/test3.py", line 16, in <module>
    partial_speck.evaluate_vectorized([plaintext, key])
  File "/home/sage/tii-claasp/claasp/cipher.py", line 743, in evaluate_vectorized
    return evaluator.evaluate_vectorized(self, cipher_input, intermediate_output, verbosity, evaluate_api, bit_based)
  File "/home/sage/tii-claasp/claasp/cipher_modules/evaluator.py", line 89, in evaluate_vectorized
    cipher_output = f_module.evaluate(cipher_input, intermediate_output)
  File "<string>", line 11, in evaluate
IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions