if_helper¶
- cryptographic_estimators.IFEstimator.if_helper.Lfunction(alpha, beta, logN)¶
Implements the exponent of the L-function L[alpha, beta] = exp((beta)*logN**alpha * log(logN)**(1-alpha) )
- Parameters:
alpha (float) – main constant in the L-function
beta (float) – another constant in the L-function
logN (float) – ln(N) of the number to factor
- Returns:
the exponent of the L-function
- Return type:
float
Examples
>>> from cryptographic_estimators.IFEstimator.if_helper import Lfunction >>> n = 1024 >>> Lfunction(0.5, 1, n) 84.2486031274931
- cryptographic_estimators.IFEstimator.if_helper.division_complexity(n)¶
- Computes the time complexity of dividing a 2n-bit integer by an n-bit integer.
See Thm. 1.4.2 in [BZ10] https://arxiv.org/pdf/1004.4710
- Parameters:
n (int) – bit length of the divisor
- Returns:
the time complexity of the division operation
- Return type:
float
Examples
>>> from cryptographic_estimators.IFEstimator.if_helper import division_complexity >>> n = 1024 >>> division_complexity(n) 1051648
- cryptographic_estimators.IFEstimator.if_helper.multipication_complexity(n)¶
Computes the time complexity of multiplying two n-bit integers.
- Parameters:
n (int) – bit length of the integers to multiply
- Returns:
the time complexity of the multiplication operation
- Return type:
float
Examples
>>> from cryptographic_estimators.IFEstimator.if_helper import multipication_complexity >>> n = 1024 >>> multipication_complexity(n) 1048576
- cryptographic_estimators.IFEstimator.if_helper.pifunction(x)¶
Implements the prime counting function π(x) which counts the number of primes less than or equal to x.
- Parameters:
x (float) – the upper limit for counting primes
- Returns:
the number of primes less than or equal to x, rounded up
- Return type:
int
Examples
>>> from cryptographic_estimators.IFEstimator.if_helper import pifunction >>> pifunction(127) 27
- cryptographic_estimators.IFEstimator.if_helper.primality_testing(n)¶
- Computes the time complexity of the Miller-Rabin primality test for an n-bit integer.
Miller-Rabin primality test with #trials = k = 64 -> n is probably prime with probability at most 2^-2k
- Parameters:
n (int) – bit length of the integer to test for primality
- Returns:
the time complexity of the Miller-Rabin primality test
- Return type:
float
Examples
>>> from cryptographic_estimators.IFEstimator.if_helper import primality_testing >>> n = 1024 >>> primality_testing(n) 68719476736