claw_finding

class cryptographic_estimators.MAYOEstimator.MAYOAlgorithms.claw_finding.ClawFinding(problem: MAYOProblem, **kwargs)

Bases: MAYOAlgorithm

Construct an instance of ClawFinding estimator.

Claw finding attack is a general attack which works against any signature which follows the hash-and-sign paradigm.

Parameters:
  • problem (MAYOProblem) – MAYOProblem object including all necessary parameters

  • **kwargs

    Additional keyword arguments

    w - Linear algebra constant (default: obtained from MAYOAlgorithm)

    h - External hybridization parameter (default: 0)

    excluded_algorithms - A list/tuple of MQ algorithms to be excluded (default: [Lokshtanov])

    memory_access - Specifies the memory access cost model (default: 0, choices: 0 - constant, 1 - logarithmic, 2 - square-root, 3 - cube-root or deploy custom function which takes as input the logarithm of the total memory usage)

    complexity_type - Complexity type to consider (0: estimate, default: 0)

    bit_complexities - Determines if complexity is given in bit operations or basic operations (default 1: in bit)

    hash_bit_size - Hash function output size given in bits (default: 512)

X()

Return logarithm of the optimal X, i.e. number of inputs (preimages).

Optimal value for X is obtained from optimizing the bit-cost expression of the attack reported in MAYO specification (see Section 5.4 in [BCCHK23]) 36 * m * X + Y * 2 ** 17 using X * Y = q ** m

Examples

>>> from cryptographic_estimators.MAYOEstimator.mayo_problem import MAYOProblem
>>> from cryptographic_estimators.MAYOEstimator.MAYOAlgorithms.claw_finding import ClawFinding
>>> E = ClawFinding(MAYOProblem(n=80, m=60, o=18, k=12, q=16))
>>> E.X()
122.962
Y()

Return logarithm of the optimal Y.

Return logarithm of the number of hashes to compute. Optimal value for Y is obtained from X * Y = q ** m using the optimal value of X.

Examples

>>> from cryptographic_estimators.MAYOEstimator.mayo_problem import MAYOProblem
>>> from cryptographic_estimators.MAYOEstimator.MAYOAlgorithms.claw_finding import ClawFinding
>>> E = ClawFinding(MAYOProblem(n=80, m=60, o=18, k=12, q=16))
>>> E.Y()
117.038
property attack_type

Returns the attack type of the algorithm.

property complexity_type

Returns the attribute _complexity_type.

get_optimal_parameters_dict()

Returns the optimal parameters dictionary.

has_optimal_parameter()

Return True if the algorithm has optimal parameter.

Tests:
>>> from cryptographic_estimators import BaseAlgorithm, BaseProblem
>>> BaseAlgorithm(BaseProblem()).has_optimal_parameter()
False
linear_algebra_constant()

Return the linear algebra constant.

Tests:
>>> from cryptographic_estimators.MAYOEstimator.mayo_algorithm import MAYOAlgorithm
>>> from cryptographic_estimators.MAYOEstimator.mayo_problem import MAYOProblem
>>> E = MAYOAlgorithm(MAYOProblem(n=66, m=64, o=8, k=9, q=16))
>>> E.linear_algebra_constant()
2.81
property memory_access

Returns the attribute _memory_access.

memory_access_cost(mem: float)

Returns the memory access cost (in logarithmic scale) of the algorithm per basic operation.

Parameters:

mem (float) – Memory consumption of an algorithm.

Returns:

Memory access cost in logarithmic scale.

Return type:

float

Note

memory_access: Specifies the memory access cost model (default: 0, choices: 0 - constant, 1 - logarithmic, 2 - square-root, 3 - cube-root or deploy custom function which takes as input the logarithm of the total memory usage)

memory_complexity(**kwargs)

Return the memory complexity of the algorithm.

Parameters:

**kwargs

Arbitrary keyword arguments.

optimal_parameters - If for each optimal parameter of the algorithm a value is provided, the computation is done based on those parameters.

optimal_parameters()

Return a dictionary of optimal parameters.

Tests:
>>> from cryptographic_estimators import BaseAlgorithm, BaseProblem
>>> BaseAlgorithm(BaseProblem()).optimal_parameters()
{}
parameter_names()

Return the list with the names of the algorithm’s parameters.

Tests:
>>> from cryptographic_estimators import BaseAlgorithm, BaseProblem
>>> BaseAlgorithm(BaseProblem()).parameter_names()
[]
property parameter_ranges

Returns the set ranges for optimal parameter search.

Returns the set ranges in which optimal parameters are searched by the optimization algorithm (used only for complexity type estimate).

quantum_time_complexity()

Return quantum gate complexity

reset()

Resets internal state of the algorithm.

set_parameter_ranges(parameter: str, min_value: float, max_value: float)

Set range of specific parameter.

If optimal parameter is already set, it must fall in that range.

Parameters:
  • parameter (str) – Name of parameter to set

  • min_value (float) – Lowerbound for parameter (inclusive)

  • max_value (float) – Upperbound for parameter (inclusive)

set_parameters(parameters: dict)

Set optimal parameters to predifined values.

Parameters:

parameters (dict) – Dictionary including parameters to set (for a subset of optimal_parameters functions)

time_complexity(**kwargs)

Return the time complexity of the algorithm.

Parameters:

**kwargs

Arbitrary keyword arguments.

optimal_parameters - If for each optimal parameter of the algorithm a value is provided, the computation is done based on those parameters.