Z-Botan-0.3.1.0: Crypto for Haskell
CopyrightDong Han 2021
LicenseBSD
Maintainerwinterland1989@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Z.Crypto.RNG

Contents

Description

Several different RNG types are implemented. Some access hardware RNGs, which are only available on certain platforms. Others are mostly useful in specific situations.

Synopsis

RNG

data RNGType Source #

RNG types.

Instances

Instances details
Eq RNGType Source # 
Instance details

Defined in Z.Crypto.RNG

Methods

(==) :: RNGType -> RNGType -> Bool #

(/=) :: RNGType -> RNGType -> Bool #

Ord RNGType Source # 
Instance details

Defined in Z.Crypto.RNG

Show RNGType Source # 
Instance details

Defined in Z.Crypto.RNG

Generic RNGType Source # 
Instance details

Defined in Z.Crypto.RNG

Associated Types

type Rep RNGType :: Type -> Type #

Methods

from :: RNGType -> Rep RNGType x #

to :: Rep RNGType x -> RNGType #

JSON RNGType Source # 
Instance details

Defined in Z.Crypto.RNG

Print RNGType Source # 
Instance details

Defined in Z.Crypto.RNG

Methods

toUTF8BuilderP :: Int -> RNGType -> Builder () #

type Rep RNGType Source # 
Instance details

Defined in Z.Crypto.RNG

type Rep RNGType = D1 ('MetaData "RNGType" "Z.Crypto.RNG" "Z-Botan-0.3.1.0-GbapUVQUdq6A2uFR3TMVx6" 'False) (C1 ('MetaCons "SystemRNG" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "AutoSeededRNG" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ProcessorRNG" 'PrefixI 'False) (U1 :: Type -> Type)))

data RNG Source #

Opaque botan RNG type.

Instances

Instances details
Show RNG Source # 
Instance details

Defined in Z.Crypto.RNG

Methods

showsPrec :: Int -> RNG -> ShowS #

show :: RNG -> String #

showList :: [RNG] -> ShowS #

Generic RNG Source # 
Instance details

Defined in Z.Crypto.RNG

Associated Types

type Rep RNG :: Type -> Type #

Methods

from :: RNG -> Rep RNG x #

to :: Rep RNG x -> RNG #

Print RNG Source # 
Instance details

Defined in Z.Crypto.RNG

Methods

toUTF8BuilderP :: Int -> RNG -> Builder () #

type Rep RNG Source # 
Instance details

Defined in Z.Crypto.RNG

type Rep RNG = D1 ('MetaData "RNG" "Z.Crypto.RNG" "Z-Botan-0.3.1.0-GbapUVQUdq6A2uFR3TMVx6" 'True) (C1 ('MetaCons "RNG" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BotanStruct)))

newRNG :: HasCallStack => RNGType -> IO RNG Source #

Initialize a random number generator object from the given RNGType

getRNG :: HasCallStack => IO RNG Source #

Get an autoseeded RNG from a global RNG pool divide by haskell capability.

Botan internal use a lock to protect user-space RNG, which may cause contention if shared. This function will fetch an autoseeded RNG from a global RNG pool, which is recommended under concurrent settings.

getRandom :: HasCallStack => RNG -> Int -> IO Bytes Source #

Get random bytes from a random number generator.

reseedRNG :: HasCallStack => RNG -> Int -> IO () Source #

Reseeds the random number generator with bits number of bits from the SystemRNG.

reseedRNGFromRNG :: HasCallStack => RNG -> RNG -> Int -> IO () Source #

Reseeds the random number generator with bits number of bits from the given source RNG.

addEntropyRNG :: HasCallStack => RNG -> Bytes -> IO () Source #

Adds the provided seed material to the internal RNG state.

This call may be ignored by certain RNG instances (such as ProcessorRNG or, on some systems, the SystemRNG).

Internal

withRNG :: RNG -> (BotanStructT -> IO a) -> IO a Source #

Use RNG as a botan_rng_t object.