Skip to content

Commit

Permalink
FIX/fix: calculate_component_weight
Browse files Browse the repository at this point in the history
This method calculates the number of ones in the output of a component
model for SAT models. It checks whether the component is non-linear.
Although CLAASP supported the MODSUB component, it was not included in
this method. This update fixes that oversight.
  • Loading branch information
juaninf committed Oct 9, 2024
1 parent fdf1bba commit e43e3b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion claasp/cipher_modules/models/sat/sat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def fix_variables_value_constraints(fixed_variables=[]):

def calculate_component_weight(self, component, out_suffix, output_values_dict):
weight = 0
if ('MODADD' in component.description or 'AND' in component.description
if ('MODSUB' in component.description or 'MODADD' in component.description or 'AND' in component.description
or 'OR' in component.description or SBOX in component.type):
weight = sum([output_values_dict[f'hw_{component.id}_{i}{out_suffix}']
for i in range(component.output_bit_size)])
Expand Down

0 comments on commit e43e3b9

Please sign in to comment.