This is the implementation of the algorithms described in the paper Just Guess: Improved Algorithm for the Underdetermined MQ Problem.
Our algorithm just_guess_transformation.sage takes as input:
-
nnumber of variables; -
mnumber of equations; -
qthe characteristic of the field$\mathbb{F}_q$ ; -
knumber of guessed coordinates; -
pthe number of MQ$(1,1)$ .
Note that the k and the p must satisfy the constraints in the paper.
just_guess_transformation.sage then generates a random MQ map with
An example:
./sage ./just_guess_transformation.sage -n 11 -m 6 -q 16 -k 2 -p 2
Our algorithm compute_complexity.py takes as input the following parameters:
-
nnumber of variables; -
mnumber of equations; -
qthe characteristic of the field$\mathbb{F}_q$ ; -
kthe number of guessed variables; -
pthe number of MQ$(1,1)$ problems; -
polyfactorsan optional switch.
The algorithm then evaluates the complexity of the Just-Guess-Solver with the corresponding inputs. If polyfactors is called, it computes the complexity including the polynomial overhead. Then, it prints
- the probability
$s_p$ ; - the number of expected nodes in the MQ tree
$e_p$ visited by the DFS; - the complexity; both classically and quantumly.
For our algorithm the library njit is additionally required.
python .\compute_complexity.py -n 860 -m 78 -q 16 -p 25 -k 34 --polyfactors
This algorithm, called prob_exp_test.py takes as input the following parameters:
-
qthe characteristic of the field$\mathbb{F}_q$ ; -
pthe number of MQ$(1,1)$ ; -
attemptsthe number of experiments we want to conduct, and returns the experimental probability$s_p$ and the experimental expectation$e_p$ .
To run the algorithm from the terminal, run for example
python prob_exp_test.py -q 16 -p 25 -attempts 10000.
Our optimization algorithm optimization_simple.py takes as input the following parameters:
-
nnumber of variables; -
mnumber of equations; -
qthe characteristic of the field$\mathbb{F}_q$ ;
The algorithm exhaustively searches for the optimal choice of the parameters
- the optimal parameters found excluding polynomial factors;
- the optimal parameters found including polynomial factors;
- the probability
$s_p$ ; - the number of expected nodes in the MQ tree
$e_p$ visited by the DFS; - the complexity without polynomial factors;
- the complexity with polynomial factors; both classically and quantumly.
For our algorithm the library njit is additionally required.
python .\optimization_simple.py 860 78 16
Our algorithm just_guess_randomised.sage takes as input:
-
nnumber of variables; -
mnumber of equations; -
qthe size of the field$\mathbb{F}_q$ ; -
knumber of guessed coordinates; -
pthe number of MQ$(1,1)$ .
The solver will to solve a random instance of the MQ problem with
An example:
./sage ./just_guess_randomised.sage 50 10 2 3 6
The scripts hashimoto.py and hashimoto_quantum.py have to be substituted to the script hashimoto.py in the MQ estimator https://github.com/Crypto-TII/CryptographicEstimators. Precisely, the path is cryptographic_estimators/MQEstimator/MQAlgorithms.
Our first script adds the second constraint needed to carry out Hashimoto's transformation, which is missing in the original script.
The second script allows to etimate the quantum complexity of Hashimoto's algorithm.
Example usage:
>>> from cryptographic_estimators.MQEstimator.MQAlgorithms.hashimoto_quantum import Hashimoto
>>> from cryptographic_estimators.MQEstimator.mq_problem import MQProblem
>>> E = Hashimoto(MQProblem(q = 16, m = 78, n = 860)).time_complexity()
