Rivest-Shamir-Adleman (RSA)

RSA Algorithm Module.

class BaselineShor(crypt_params: CryptParams, alg_params: BaselineShorParams | None = None)[source]

Bases: QuantumAlgorithm

Class for the baseline implementation of Shor’s algorithm.

Initialize the quantum algorithm.

Parameters:
  • crypt_params (CryptParams) – Cryptographic parameters.

  • alg_params (Optional[BaselineShorParams], optional) – Algorithmic parameters. For BaselineShor, these have no effect but are included for consistency.

static generate_search_space() list[BaselineShorParams][source]

Generate a search space for algorithm parameters.

Since BaselineShor doesn’t have configurable parameters, this returns a list with a single set of default parameters.

Returns:

Single-element list containing default parameters.

Return type:

list[BaselineShorParams]

get_algorithm_summary(alg_params: AlgParams | None = None) AlgorithmSummary[source]

Compute logical resource estimates for the circuit.

Parameters:

alg_params (Optional[AlgParams], optional) – Algorithm parameters (not used by BaselineShor)

Returns:

Logical resource estimates.

Return type:

AlgorithmSummary

Raises:

NameError – If the protocol is not “RSA”.

class BaselineShorParams[source]

Bases: AlgParams

Dataclass describing the parameters for baseline Shor’s algorithm.

Note: The basic implementation doesn’t have configurable parameters, but this class is provided for consistency with the interface.

class Chevignard(crypt_params: CryptParams, alg_params: ChevignardParams | None = None)[source]

Bases: QuantumAlgorithm

Qualtran wrapper for Chevignard et. al’s ctrl multi product RSA algorithm.

Initialize the quantum algorithm.

Parameters:
  • crypt_params (CryptParams) – Cryptographic parameters.

  • alg_params (Optional[AlgParams], optional) – Algorithmic parameters, by default None

static generate_search_space() list[ChevignardParams][source]

Generate the search space for the Chevignard algorithm.

Returns:

list[ChevignardParams] – the parameter configurations to explore.

Return type:

A list of ChevignardParams instances defining

get_algorithm_summary(alg_params: AlgParams | None = None) AlgorithmSummary[source]

Estimate the resource requirements for controlled multi product.

Raises:
  • NameError – Chevignard only supports protocol “RSA”.:

  • NameError – If the protocol is not “RSA”.

Parameters:

(AlgParams) (alg_params)

Returns:

AlgorithmSummary

Return type:

Resource requirements for the algorithm.

class ChevignardParams[source]

Bases: AlgParams

(No tunable parameters for Chevignard; placeholder.).

class GidneyEkera(crypt_params: CryptParams, alg_params: GidneyEkeraParams | None = None)[source]

Bases: QuantumAlgorithm

Class for a parameterised implementation of Gidney-Ekera.

Initialise the quantum algorithm.

Parameters:
  • crypt_params (CryptParams) – Cryptographic parameters.

  • alg_params (Optional[GidneyEkeraParams], optional) – Algorithmic parameters, by default None

generate_search_space() list[GidneyEkeraParams][source]

Generate a search space for algorithm parameters.

Creates a comprehensive range of algorithm parameters to search over, including: - Fixed number of exponent qubits (typically 1.5x key size) - Various window sizes for exponentiation (2-7) - Various window sizes for multiplication (2-7)

Returns:

List of GidneyEkeraParams with various parameter combinations.

Return type:

list[GidneyEkeraParams]

get_algorithm_summary(alg_params: AlgParams | None = None) AlgorithmSummary[source]

Compute logical resource estimates for the circuit.

Parameters:

alg_params (Optional[AlgParams], optional) – Algorithm parameters to use for the summary. If None, uses the parameters stored in the instance (self._alg_params).

Returns:

Logical resource estimates.

Return type:

AlgorithmSummary

Raises:
  • NameError – If the protocol is not “RSA”.

  • ValueError – If no algorithm parameters are provided.

  • TypeError – If alg_params is not GidneyEkeraParams.

class GidneyEkeraBasic(crypt_params: CryptParams, alg_params: GidneyEkeraBasicParams | None = None)[source]

Bases: QuantumAlgorithm

Class for a basic implementation of Gidney-Ekera.

Initialize the quantum algorithm.

Parameters:
  • crypt_params (CryptParams) – Cryptographic parameters.

  • alg_params (Optional[GidneyEkeraBasicParams], optional) – Algorithmic parameters. For the basic implementation, these have no effect but are included for API consistency.

static generate_search_space() list[GidneyEkeraBasicParams][source]

Generate a search space for algorithm parameters.

Since GidneyEkeraBasic doesn’t have configurable parameters, this returns a list with a single set of default parameters.

Returns:

Single-element list containing default parameters.

Return type:

list[GidneyEkeraBasicParams]

get_algorithm_summary(alg_params: AlgParams | None = None) AlgorithmSummary[source]

Compute logical resource estimates for the circuit.

Parameters:

alg_params (Optional[AlgParams], optional) – Algorithm parameters (not used in this basic implementation)

Returns:

Logical resource estimates.

Return type:

AlgorithmSummary

Raises:

NameError – If the protocol is not “RSA”.

class GidneyEkeraBasicParams[source]

Bases: AlgParams

Parameters for the basic implementation of Gidney-Ekera.

This implementation doesn’t have configurable parameters, but this class is provided for consistency with the interface.

class GidneyEkeraParams(num_exp_qubits: int, window_size_exp: int, window_size_mul: int)[source]

Bases: AlgParams

Dataclass describing the parameters for Gidney-Ekera.

Parameters:
  • num_exp_qubits (int) – Number of exponent qubits. Denoted $n_e$ in [1].

  • window_size_exp (int) – Exponentiation windows size. Denoted $n_{exp}$ in [1].

  • window_size_mul (int) – Multiplication window size. Denoted $n_{mul}$ in [1].

num_exp_qubits: int
window_size_exp: int
window_size_mul: int