Skip to content

Commit

Permalink
Merge pull request #249 from Crypto-TII/fix/vectorized_evaluation_for…
Browse files Browse the repository at this point in the history
…_partially_inverted_cipher

FIX/Fix: 'plaintext' key error when using vectorized evaluation on a …
  • Loading branch information
peacker authored Jun 19, 2024
2 parents 9e4de0d + 0b04b97 commit a0b024a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion claasp/cipher_modules/code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,13 @@ def generate_byte_based_vectorized_python_code_string(cipher, store_intermediate
if store_intermediate_outputs:
code.append(' return intermediateOutputs')
elif CIPHER_INVERSE_SUFFIX in cipher.id:
code.append(' return intermediateOutputs["plaintext"]')
# full inversion
if 'plaintext' in cipher.get_all_components_ids():
code.append(' return intermediateOutputs["plaintext"]')
# in partial inversion
else:
code.append(' last_inter_output = [output for output in list(intermediateOutputs.keys()) if \'intermediate_output\' in output][0]')
code.append(' return intermediateOutputs[last_inter_output]')
else:
code.append(' return intermediateOutputs["cipher_output"]')
# print('\n'.join(code))
Expand Down

0 comments on commit a0b024a

Please sign in to comment.