Repository navigation
Feature/quasidifferential implementation - #515
Merged
Merged
Conversation
michelag99
force-pushed
the
feature/quasidifferential-implementation
branch
from
September 10, 2026 14:56
0886dbc to
f0bcc31
Compare
michelag99
force-pushed
the
feature/quasidifferential-implementation
branch
from
September 15, 2026 09:37
2acf857 to
8aa95cb
Compare
|
… masks The model now works out each S-box's input and output difference from the values the caller already fixed, so the S-box leaves out every transition that disagrees with them. This reduces the size of the generated model enormously. An S-box the characteristic does not decide keeps its whole table, so searching is unaffected. Collect key masks from every input carrying key material. remove_key_schedule() names the round keys key_0_2, key_1_2 and so on, so looking only for an input named exactly key found none of them and left nothing to cancel in the key-averaged probability. Add boundary_masks(), returning the fixed_masks list that sets the input and output masks to zero. It covers every component the final round emits, since pinning only one leaves the other free and inflates the trail count. Add tests for the derived differences, the reduced S-box constraints, and the agreement between the key-averaged probability and the differential model.
…y condition boundary_masks was including key-schedule outputs, because a round-key output has the same component type as a round output. Filter on the description instead, and raise when the cipher has no plaintext input. Give find_one_xor_quasidifferential_trail_with_fixed_weight a fixed_masks argument, so it can express the input and output masks being zero, and route the mask assertions through one _apply_fixed_masks helper. test_compute_trail_sign depended on solver order; it now sets the boundary, which makes the weight-13 trail unique.
…fferences_and_key_inputs Fix/quasidifferential sbox differences and key inputs
The four find_* methods now take fixed_masks, routed through the existing _apply_fixed_masks helper. Without it they can only return trails whose input or output mask is non-zero, and those are not trails of the characteristic.
…asks_on_find_methods Add fixed_masks to the remaining find_* methods
Add the INPUT sections missing from the quasidifferential model, its utils and component methods, and cite Beyne & Rijmen as [BR2022]. Join signatures and calls that fit in 120 columns, drop superfluous blank lines, fix the license header, and wrap docstrings and comments at 100 columns with one-line summaries. No behaviour change.
…l-docs Change: document SMT quasidifferential model
…e get_ prefix removal from develop (#527) The merge of develop into feature/quasidifferential-implementation brought in d336256, which renamed Cipher.get_all_components() to all_components(). The quasidifferential SMT model and its unit tests still called the old name, breaking 44 pytest cases and the module's doctests.
…ebner timeout The fixture ran AlgebraicTests on 2-round Speck32/64 with a 1 s timeout, so the alarm fired in every round. PolyBoRi only honours the interrupt at sparse signal checks, sometimes minutes later, which made test_save_as_image randomly exceed the 1000 s per-test timeout on the x86_64 runner (also seen on develop, where it passed on retry). Use 1-round Speck8/16, whose Groebner basis completes in well under a second, so the report is built without interrupting PolyBoRi.
…fix-removal Fix: use all_components() in the SMT quasidifferential model after the get_ prefix removal (#527)
…y_masks_by_default Fix: default fixed_masks to the boundary in estimate_fixed_key_probab…
peacker
previously approved these changes
Oct 23, 2026
… cognitive complexity SonarCloud (python:S3776) flagged _difference_bit_map in the SMT quasidifferential model with a Cognitive Complexity of 19 against the 15 allowed. Move the nested SHIFT handling into a _shift_bit_map static helper, bringing it down to 10. The behaviour is unchanged.
test_save_as_latex_table, test_save_as_dataframe and test_save_as_json all exported into the default ./test_reports and each ended with clean_reports(), which deletes that folder. Run in parallel by xdist, one test could delete the folder while another was still writing into it (seen on the x86_64 runner as 'OSError: Cannot save file into a non-existent directory' in test_save_as_dataframe). Export and clean into a per-test tmp_path folder instead, as test_save_as_image already does.
…ognitive-complexity Refactor: reduce the cognitive complexity of _difference_bit_map (SonarCloud S3776)
|
peacker
approved these changes
Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Constraints of SMT quasidifferential model are implemented on the main components: Sbox, XOR, LinearLayer, Permutation, Rotate, MixColumn, CipherOutput, Constant, AND, OR, MODADD, MODSUB, NOT, SHIFT.
This functions are implemented:
find_one_xor_quasidifferential_trailfind_one_xor_quasidifferential_trail_with_fixed_weightfind_lowest_weight_xor_quasidifferential_trailfind_all_xor_quasidifferential_trails_with_fixed_weightcompute_trail_sign(solution)