Open
Conversation
…) optimization - Extract duplicated 'if candidate < best' conditional logic into _update_best_branch_number() helper - Add GF(2) fast-path detection: delegate to optimized binary algorithm when field is GF(2) - Consolidate 4 weight-tier loops to use consistent helper function for state updates - All tests passing: branch_number_with_word_format_exact_mix_column, branch_number_with_bit_format
…tations and warnings
…d implementations - Create compute_branch_number_from_binary_matrix_with_sage() for LinearCode-based computation - Create compute_branch_number_from_binary_matrix_with_bounded_enumeration() for bounded search - Create compute_branch_number_from_binary_matrix() wrapper with method parameter (default='sage') - Create compute_branch_number_from_field_matrix_with_sage() for LinearCode-based computation - Create compute_branch_number_from_field_matrix_with_bounded_enumeration() for bounded search - Create compute_branch_number_from_field_matrix() wrapper with method parameter (default='sage') - Both wrappers support method='sage' (exact) and method='bounded' (fallback) options - Add comprehensive pytest test suite: 49 tests across 7 test classes - Test classes: TestBinaryMatrixWithSage, TestBinaryMatrixWithBoundedEnumeration TestBinaryMatrixW - Create compute_branch_number_from_binary_matrix_with_sage() for LinearCode-based computation - Create compute_branch_number_from_binary_matrix_with_bounded_enumeration() for bounded s co- Ctibility (sage is default method)
…lumn Sage's LinearCode.minimum_distance() delegates to GAP internally, which only supports Givaro GF(2^m) fields defined by Conway polynomials. Cipher fields (e.g. AES GF(2^8) with the Rijndael polynomial x^8+x^4+x^3+x+1) use a non-Conway Givaro representation, causing: NotImplementedError: conversion of (Givaro) finite field element to GAP not implemented except for fields defined by Conway polynomials. This broke the branch_number() and has_maximal_branch_number() doctests (and any call through calculate_weights_for_mix_column). Fix: change calculate_weights_for_mix_column to use method='bounded' explicitly. For AES's 4×4 MDS matrix the branch number (5) is achieved at input weight 1 (1+4=5), so bounded enumeration with default max_input_weight=3 gives the exact result without needing GAP. Also add a NOTE comment in compute_branch_number_from_field_matrix_with_sage explaining the GAP/Conway restriction, and update the method parameter docstring in the wrapper to document the limitation.
…teractive plotting
# Conflicts: # tests/unit/cipher_modules/component_analysis_tests_test.py
DavidGerault
previously approved these changes
Mar 23, 2026
michelag99
previously approved these changes
Mar 23, 2026
ale-depi
previously approved these changes
Mar 23, 2026
…ix/branch-number-computation
95fb31b
|
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.



This branch overhauls branch-number computation and test coverage/performance for component analysis, with a focus on correctness across finite-field representations and practical runtime.
What changed
Refactored branch-number logic into explicit method-specific functions:
Added optimized bounded search behavior:
Improved GF(2) handling:
Hardened runtime behavior:
Added exact custom-field compatibility fix:
Kept MixColumn word-level path runtime-safe:
Expanded and aligned documentation: