| |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| Description | |||||||||||||||||||||||||||||||
| BN - multiprecision integer arithmetics | |||||||||||||||||||||||||||||||
| Synopsis | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| Type | |||||||||||||||||||||||||||||||
| data BigNum | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| Allocation | |||||||||||||||||||||||||||||||
| allocaBN :: (BigNum -> IO a) -> IO a | |||||||||||||||||||||||||||||||
| allocaBN f allocates a BigNum and computes f. Then it frees the BigNum. | |||||||||||||||||||||||||||||||
| withBN :: Integer -> (BigNum -> IO a) -> IO a | |||||||||||||||||||||||||||||||
| withBN n f converts n to a BigNum and computes f. Then it frees the BigNum. | |||||||||||||||||||||||||||||||
| newBN :: Integer -> IO BigNum | |||||||||||||||||||||||||||||||
| This is an alias to integerToBN. | |||||||||||||||||||||||||||||||
| Conversion from/to Integer | |||||||||||||||||||||||||||||||
| peekBN :: BigNum -> IO Integer | |||||||||||||||||||||||||||||||
| This is an alias to bnToInteger. | |||||||||||||||||||||||||||||||
| integerToBN :: Integer -> IO BigNum | |||||||||||||||||||||||||||||||
| This is a GHC specific, fast conversion between Integers and OpenSSL bignums. It returns a malloced BigNum. | |||||||||||||||||||||||||||||||
| bnToInteger :: BigNum -> IO Integer | |||||||||||||||||||||||||||||||
| Convert a BIGNUM to an Integer | |||||||||||||||||||||||||||||||
| integerToMPI :: Integer -> IO ByteString | |||||||||||||||||||||||||||||||
| Convert an Integer to an MPI. SEe bnToMPI for the format | |||||||||||||||||||||||||||||||
| mpiToInteger :: ByteString -> IO Integer | |||||||||||||||||||||||||||||||
| Convert an MPI to an Integer. SEe bnToMPI for the format | |||||||||||||||||||||||||||||||
| Computation | |||||||||||||||||||||||||||||||
| modexp :: Integer -> Integer -> Integer -> Integer | |||||||||||||||||||||||||||||||
| modexp a p m computes a to the p-th power modulo m. | |||||||||||||||||||||||||||||||
| Random number generation | |||||||||||||||||||||||||||||||
| randIntegerUptoNMinusOneSuchThat | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| prandIntegerUptoNMinusOneSuchThat | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| randIntegerZeroToNMinusOne :: Integer -> IO Integer | |||||||||||||||||||||||||||||||
| Return a strongly random number in the range 0 <= x < n | |||||||||||||||||||||||||||||||
| prandIntegerZeroToNMinusOne :: Integer -> IO Integer | |||||||||||||||||||||||||||||||
| Return a random number in the range 0 <= x < n | |||||||||||||||||||||||||||||||
| randIntegerOneToNMinusOne :: Integer -> IO Integer | |||||||||||||||||||||||||||||||
| Return a strongly random number in the range 0 < x < n | |||||||||||||||||||||||||||||||
| prandIntegerOneToNMinusOne :: Integer -> IO Integer | |||||||||||||||||||||||||||||||
| Return a random number in the range 0 < x < n | |||||||||||||||||||||||||||||||
| Produced by Haddock version 0.8 | |||||||||||||||||||||||||||||||