License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Stability | experimental |
Portability | Good |
Safe Haskell | None |
Language | Haskell98 |
- expSafe :: Integer -> Integer -> Integer -> Integer
- expFast :: Integer -> Integer -> Integer -> Integer
- exponentiation_rtl_binary :: Integer -> Integer -> Integer -> Integer
- exponentiation :: Integer -> Integer -> Integer -> Integer
- exponantiation_rtl_binary :: Integer -> Integer -> Integer -> Integer
- exponantiation :: Integer -> Integer -> Integer -> Integer
- inverse :: Integer -> Integer -> Maybe Integer
- inverseCoprimes :: Integer -> Integer -> Integer
exponentiation
Compute the modular exponentiation of base^exponant using algorithms design to avoid side channels and timing measurement
Modulo need to be odd otherwise the normal fast modular exponentiation is used.
When used with integer-simple, this function is not different from expFast, and thus provide the same unstudied and dubious timing and side channels claims.
Compute the modular exponentiation of base^exponant using the fastest algorithm without any consideration for hiding parameters.
Use this function when all the parameters are public,
otherwise expSafe
should be prefered.
exponentiation_rtl_binary :: Integer -> Integer -> Integer -> Integer Source
exponentiation_rtl_binary computes modular exponentiation as b^e mod m using the right-to-left binary exponentiation algorithm (HAC 14.79)
exponentiation :: Integer -> Integer -> Integer -> Integer Source
exponentiation computes modular exponentiation as b^e mod m using repetitive squaring.
deprecated name for exponentiation
inverse computing
inverse :: Integer -> Integer -> Maybe Integer Source
inverse computes the modular inverse as in g^(-1) mod m
inverseCoprimes :: Integer -> Integer -> Integer Source
Compute the modular inverse of 2 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.