BooleanSolve doctest failing with Python
Dioprz opened this issue · 1 comments
@fmerino21 had shared with me some days ago that one of the UOVEstimator doctest was failing when running with Python instead of Sage.
The failing doctest is this one:
Steps to reproduce
-
make docker-run
-
In a python3 REPL, run:
from cryptographic_estimators.UOVEstimator import UOVEstimator A = UOVEstimator(n=184, m=72, q=256, theta=None) A.table(show_all_parameters=1) # long time
You will get:
... File "/home/cryptographic_estimators/cryptographic_estimators/MQEstimator/MQAlgorithms/booleansolve_fxl.py", line 184, in _compute_time_complexity time_complexity = q**k * m * binomial(n - k + wit_deg, wit_deg) ** w OverflowError: int too large to convert to float
-
If you run the same in a sage REPL, everything works normally (this will take some minutes).
Solution:
The error comes from the file cryptographic_estimators/MQEstimator/MQAlgorithms/booleansolve_fxl.py
, specifically from this lines of the _compute_time_complexity
method:
Specifically, from the expression q**k * m * binomial(n - k + wit_deg, wit_deg) ** w
The issue can likely be solved by integrating the log2
directly into the if/elif blocks, so logarithms properties help us lowering the powers.
Did you agree? Could any of you help me ensuring this will not break anything (or implementing the patch) please? @Memphisd @Javierverbel @FloydZ