Inverse cipher

add_bit_to_bit_list(bit, bit_list)
add_new_component_to_list(component, component_list)
all_input_bits_available(component, available_bits)
all_output_bits_available(component, available_bits)
all_output_updated_bits_available(component, available_bits)
are_equal_components(component1, component2)
are_there_enough_available_inputs_to_evaluate_component(component, available_bits, all_equivalent_bits, key_schedule_components, self)
are_there_enough_available_inputs_to_perform_inversion(component, available_bits, all_equivalent_bits, self)

NOTE: it assumes that the component input size is a multiple of the output size

are_these_bits_available(bits_list, available_bits)
cipher_find_component(cipher, round_number, component_id)
component_input_bits(component)
component_inverse(component, available_bits, all_equivalent_bits, key_schedule_components, self)

This functions assumes that the component is actually invertible.

component_output_bits(component, self)

Delete orphans elements from input_id_link INPUT: - cipher – dictionary with a graph representation - round_number – round index

equivalent_bits_in_common(bits_of_an_output_component, component_bits, all_equivalent_bits)
evaluated_component(component, available_bits, key_schedule_component_ids, all_equivalent_bits, self)
find_correct_order(id1, list1, id2, list2, all_equivalent_bits)
find_correct_order_for_inversion(list1, list2, component)
get_all_bit_names(self)
get_all_equivalent_bits(self)
get_available_output_components(component, available_bits, self, return_index=False)
get_cipher_components(self)
get_component_from_id(component_id, self)
get_equivalent_input_bit_from_output_bit(potential_unwanted_component, base_component, available_bits, all_equivalent_bits, key_schedule_components, self)
get_key_schedule_component_ids(self)
get_most_recent_intermediate_output(target_link, intermediate_outputs)
get_output_components(component, self)
get_relative_position(target_link, target_bit_positions, intermediate_output)
is_bit_adjacent_to_list_of_bits(bit_name, list_of_bit_names, all_equivalent_bits)
is_bit_contained_in(bit, available_bits)
is_output_bits_updated_equivalent_to_input_bits(output_bits_updated_list, input_bits_list, all_equivalent_bits)
is_possibly_invertible_component(component)
remove_components_from_rounds(cipher, start_round, end_round, keep_key_schedule)
sort_cipher_graph(cipher)

Sorts the cipher graph in a way that each component input is defined before the current component.

INPUT: - cipher – graph representation of a cipher as a python dictionary

EXAMPLE::

sage: from claasp.ciphers.toys.identity_block_cipher import IdentityBlockCipher sage: from claasp.cipher_modules.inverse_cipher import sort_cipher_graph sage: identity = IdentityBlockCipher() sage: sort_cipher_graph(identity) identity_block_cipher_p32_k32_o32_r1

topological_sort(round_list)

Perform topological sort on round components. INPUT: - round_list – list of components

update_available_bits_with_component_input_bits(component, available_bits)
update_available_bits_with_component_output_bits(component, available_bits, cipher)
update_output_bits(inverse_component, self, all_equivalent_bits, available_bits)