if_estimator

class cryptographic_estimators.IFEstimator.if_estimator.IFEstimator(n: int, memory_bound=inf, **kwargs)

Bases: BaseEstimator

Construct an instance of Integer Factoring Estimator.

Args: - n (int): bit length of RSA integer to be factored - memory_bound (int, optional): maximum allowed memory to use for solving the problem (default: infinity)

algorithm_names()

Return a list of the name of considered algorithms.

algorithms()

Return a list of considered algorithms.

property bit_complexities

Returns a list of bit_complexities attributes of included algorithms.

property complexity_type

Returns a list of complexity_type attributes of included algorithms.

estimate(**kwargs)

Returns dictionary describing the complexity of each algorithm and its optimal parameters.

property estimator_type

Returns the type of the estimator.

Either problem or scheme

excluded_algorithms_by_default = []
fastest_algorithm(use_tilde_o_time=False)

Return the algorithm with the smallest time complexity.

Parameters:

use_tilde_o_time (bool) – Use Ō time complexity, i.e., ignore polynomial factors. Default is False.

property memory_access

Returns a list of memory_access attributes of included algorithms.

nalgorithms()

Return the number of considered algorithms.

reset()

Resets the internal states of the estimator and all included algorithms.

table(show_quantum_complexity=0, show_tilde_o_time=0, show_all_parameters=0, precision=1, truncate=0, parameters_inside=False, *args, **kwargs)

Print table describing the complexity of each algorithm and its optimal parameters

Parameters:
  • show_quantum_complexity (-) – False)

  • show_tilde_o_time (-) – False)

  • show_all_parameters (-) – False)

  • precision (-)

  • truncate (-) – False)

  • parameters_inside (-) – Shows the Problem parameters in the top left corner

Examples

>>> from cryptographic_estimators.IFEstimator import *
>>> A = IFEstimator(n=4096)
>>> A.table(show_tilde_o_time=1)
+---------------+-----------------+------------------+
|               |     estimate    | tilde_o_estimate |
+---------------+--------+--------+--------+---------+
| algorithm     |   time | memory |   time |  memory |
+---------------+--------+--------+--------+---------+
| TrialDivision | 2070.0 |   2037 | 2047.0 |    2037 |
| Lenstra       |  285.0 |   14.6 |  261.0 |    14.6 |
| GNFS          |  144.6 |   85.5 |  156.5 |    85.5 |
+---------------+--------+--------+--------+---------+
Tests:
>>> from cryptographic_estimators.IFEstimator import *
>>> A = IFEstimator(n=2048)
>>> A.table(show_tilde_o_time=1, precision=0)
+---------------+---------------+------------------+
|               |    estimate   | tilde_o_estimate |
+---------------+------+--------+-------+----------+
| algorithm     | time | memory |  time |   memory |
+---------------+------+--------+-------+----------+
| TrialDivision | 1045 |   1014 |  1023 |     1014 |
| Lenstra       |  199 |     14 |   177 |       14 |
| GNFS          |  105 |     65 |   117 |       65 |
+---------------+------+--------+-------+----------+