Skip to content

Commit

Permalink
Merge pull request #250 from Crypto-TII/fix/remove_unused_id_links_fr…
Browse files Browse the repository at this point in the history
…om_partial_inversion

FIX/fix: Simplify component id_links in partial inversion
  • Loading branch information
peacker authored Jun 25, 2024
2 parents a0b024a + 9d96583 commit d19b1b8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions claasp/cipher_modules/inverse_cipher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,12 @@ def evaluated_component(component, available_bits, key_schedule_component_ids, a
else:
input_id_links = [[]]
input_bit_positions = [[]]

empty_indices = [j for j, positions in enumerate(input_bit_positions) if positions == []]
for index in sorted(empty_indices, reverse=True):
del input_id_links[index]
del input_bit_positions[index]

evaluated_component = Component(component.id, component.type, Input(component.input_bit_size, input_id_links, input_bit_positions),
component.output_bit_size, component.description)
evaluated_component.__class__ = component.__class__
Expand Down

0 comments on commit d19b1b8

Please sign in to comment.