prime package:cryptonite
Test whether a point belongs to the prime-order subgroup generated by
the base point. Result is
True for the identity point.
pointHasPrimeOrder p = pointNegate p == pointMul l_minus_one p
Compute the modular inverse of two coprime numbers. This is equivalent
to inverse except that the result is known to exists.
If the numbers are not defined as coprime, this function will raise a
CoprimesAssertionError.
Find a prime from a starting point with no specific property.
Find a prime from a starting point where the property hold.
Generate a prime number of the required bitsize (i.e. in the range
[2^(b-1)+2^(b-2), 2^b)).
May throw a
CryptoError_PrimeSizeInvalid if the requested size
is less than 5 bits, as the smallest prime meeting these conditions is
29. This function requires that the two highest bits are set, so that
when multiplied with another prime to create a key, it is guaranteed
to be of the proper size.
Generate a prime number of the form 2p+1 where p is also prime. it is
also knowed as a Sophie Germaine prime or safe prime.
The number of safe prime is significantly smaller to the number of
prime, as such it shouldn't be used if this number is supposed to be
kept safe.
May throw a
CryptoError_PrimeSizeInvalid if the requested size
is less than 6 bits, as the smallest safe prime with the two highest
bits set is 59.
Test is two integer are coprime to each other
Returns if the number is probably prime. First a list of small primes
are implicitely tested for divisibility, then a fermat primality test
is used with arbitrary numbers and then the Miller Rabin algorithm is
used with an accuracy of 30 recursions.
Define an elliptic curve in 𝔽p. The first parameter is the Prime
Number.