crypto-numbers-0.1.3: Cryptographic numbers: functions and algorithms

PortabilityGood
Stabilityexperimental
MaintainerVincent Hanquez <vincent@snarc.org>
Safe HaskellSafe-Inferred

Crypto.Number.ModArithmetic

Description

 

Synopsis

Documentation

exponantiation_rtl_binary :: Integer -> Integer -> Integer -> IntegerSource

exponantiation_rtl_binary computes modular exponantiation as b^e mod m using the right-to-left binary exponentiation algorithm (HAC 14.79)

exponantiation :: Integer -> Integer -> Integer -> IntegerSource

exponantiation computes modular exponantiation as b^e mod m using repetitive squaring.

inverse :: Integer -> Integer -> Maybe IntegerSource

inverse computes the modular inverse as in g^(-1) mod m

inverseCoprimes :: Integer -> Integer -> IntegerSource

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.