International Association for Cryptologic Research

International Association
for Cryptologic Research

ASIACRYPT 2024

Reducing the Number of Qubits in Quantum Information Set Decoding


README

Reducing the Number of Qubits in Quantum Information Set Decoding

This code is licensed under the GNU Affero General Public License (see LICENSE.md).
The sub-folder compressed_prange/quantum_util is licensed under the MIT license.

This code can be used to run, test and benchmark various quantum circuits
defined throughout the paper. We use the Qiskit framework,
Python3 and Sympy.

The quantum circuits that we define are subclasses of Qiskit's
QuantumCircuit class.

We only tested our circuits on small instances. The gate counts of larger
instances are obtained via detailed formulas, which are deduced in a bottom-up
way by adding the costs of the various sub-circuits. These costs are those
returned by the class methods .all_counts() (returning a triple: depth,
number of qubits, gate counts, where the number of qubits always includes the
circuit inputs, outputs and ancillas).

Requirements

Python packages:

You can install all of them with:

pip3 install qiskit numpy sympy tabulate argparse

Older versions might work but the code hasn't been tested on them.

List of files

The files:

were taken from "Reducing the number of qubits in quantum factoring"
(Chevignard, Fouque, Schrottenloher, 2024). The original version of
this code is available here.

The script files are:

The source files are:

Testing circuits

Run:

python3 test_circuits.py

to instantiate most of our quantum circuits on small instances, test that they return correct
outputs on various random inputs, and check that the theoretical cost estimates
output by the function .all_counts of each class matches or exceeds the actual cost of
the small circuit instances. Failed tests should raise an assertion error. The
contents of each test are coded in the method .test() of each class.

Cost estimates

Run:

python3 estimations.py --table previous
python3 estimations.py --table new --mult spaceopt
python3 estimations.py --table new --mult toffoliopt
python3 estimations.py --table new --mult karatsuba

in order to obtain all sub-sections of Table 1 in order. The script has three
options:

This may take some time, but should not take more than a few minutes.

Asymptotic formulas

Run:

python3 asymptotic.sage.py spaceopt --simplify
python3 asymptotic.sage.py toffoliopt --simplify 

to obtain simplified asymptotic formulas for the costs (depth and gate counts)
of the inversion circuit. These formulas assume that k = O(n). The higher-order
terms will correspond to the formulas given in Section 5 of the paper for the
space-optimized and Toffoli-optimized circuits, respectively. Some lower-order
terms which we also gave in the paper will be missing.

Karatsuba-based multiplication is not supported at the moment. The resulting
formulas would be too complicated to simplify automatically, because of the
constant parameter 'limit' used in the KaratsubaMultiplier class.

Without the option --simplify, the formulas will not be simplified.