Safe Haskell | None |
---|---|
Language | Haskell2010 |
BN - multiprecision integer arithmetics
- data BigNum
- allocaBN :: (BigNum -> IO a) -> IO a
- withBN :: Integer -> (BigNum -> IO a) -> IO a
- newBN :: Integer -> IO BigNum
- peekBN :: BigNum -> IO Integer
- integerToBN :: Integer -> IO BigNum
- bnToInteger :: BigNum -> IO Integer
- integerToMPI :: Integer -> IO ByteString
- mpiToInteger :: ByteString -> IO Integer
- modexp :: Integer -> Integer -> Integer -> Integer
- randIntegerUptoNMinusOneSuchThat :: (Integer -> Bool) -> Integer -> IO Integer
- prandIntegerUptoNMinusOneSuchThat :: (Integer -> Bool) -> Integer -> IO Integer
- randIntegerZeroToNMinusOne :: Integer -> IO Integer
- prandIntegerZeroToNMinusOne :: Integer -> IO Integer
- randIntegerOneToNMinusOne :: Integer -> IO Integer
- prandIntegerOneToNMinusOne :: Integer -> IO Integer
Type
Allocation
Conversion from/to Integer
integerToMPI :: Integer -> IO ByteString Source #
Convert an Integer to an MPI. See bnToMPI for the format
mpiToInteger :: ByteString -> IO Integer Source #
Convert an MPI to an Integer. See bnToMPI for the format
Computation
modexp :: Integer -> Integer -> Integer -> Integer Source #
computes modexp
a p ma
to the p
-th power modulo m
.
Random number generation
randIntegerUptoNMinusOneSuchThat Source #
Return a strongly random number in the range 0 <= x < n where the given filter function returns true.
prandIntegerUptoNMinusOneSuchThat Source #
Return a random number in the range 0 <= x < n where the given filter function returns true.
randIntegerZeroToNMinusOne :: Integer -> IO Integer Source #
Return a strongly random number in the range 0 <= x < n
prandIntegerZeroToNMinusOne :: Integer -> IO Integer Source #
Return a random number in the range 0 <= x < n