HsOpenSSL-0.11.4.14: Partial OpenSSL binding for Haskell

Safe HaskellNone
LanguageHaskell2010

OpenSSL.BN

Contents

Description

BN - multiprecision integer arithmetics

Synopsis

Type

data BigNum Source #

BigNum is an opaque object representing a big number.

Allocation

allocaBN :: (BigNum -> IO a) -> IO a Source #

allocaBN f allocates a BigNum and computes f. Then it frees the BigNum.

withBN :: Integer -> (BigNum -> IO a) -> IO a Source #

withBN n f converts n to a BigNum and computes f. Then it frees the BigNum.

newBN :: Integer -> IO BigNum Source #

This is an alias to integerToBN.

Conversion from/to Integer

peekBN :: BigNum -> IO Integer Source #

This is an alias to bnToInteger.

integerToBN :: Integer -> IO BigNum Source #

Return a new, alloced BIGNUM.

bnToInteger :: BigNum -> IO Integer Source #

Convert a BIGNUM to an 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 #

modexp a p m computes a to the p-th power modulo m.

Random number generation

randIntegerUptoNMinusOneSuchThat Source #

Arguments

:: (Integer -> Bool)

a filter function

-> Integer

one plus the upper limit

-> IO Integer 

Return a strongly random number in the range 0 <= x < n where the given filter function returns true.

prandIntegerUptoNMinusOneSuchThat Source #

Arguments

:: (Integer -> Bool)

a filter function

-> Integer

one plus the upper limit

-> IO Integer 

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

randIntegerOneToNMinusOne :: Integer -> IO Integer Source #

Return a strongly random number in the range 0 < x < n

prandIntegerOneToNMinusOne :: Integer -> IO Integer Source #

Return a random number in the range 0 < x < n