Copyright | © Jeremy Bornstein 2019 |
---|---|
License | Apache 2.0 |
Maintainer | jeremy@bornstein.org |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Pseudorandom number generation for NewHope.
This module contains the public interface. Implementation definitions are in the Crypto.NewHope.Internal.RNG module.
Synopsis
- data Context
- class RandomSeedable a
- makeRandomSeed :: RandomSeedable a => a -> RandomSeed
- randomBytesInit :: RandomSeed -> Maybe RandomSeed -> Integer -> Context
- randomBytes :: Context -> Int -> (ByteString, Context)
Documentation
State for pseudorandom number generation
class RandomSeedable a Source #
Strings or ByteStrings may be used for source data.
Instances
RandomSeedable String Source # | |
Defined in Crypto.NewHope.Internal.RNG makeRandomSeed :: String -> RandomSeed Source # | |
RandomSeedable ByteString Source # | |
Defined in Crypto.NewHope.Internal.RNG makeRandomSeed :: ByteString -> RandomSeed Source # |
makeRandomSeed :: RandomSeedable a => a -> RandomSeed Source #
Uses external entropy (precisely 48 bytes) to create a RandomSeed
, used for initializing the pseudorandom number generator
:: RandomSeed | External entropy to seed the generator |
-> Maybe RandomSeed | Optional additional entropy to include |
-> Integer | Security strength: unused by this implementation |
-> Context | The resulting PRNG state |
Creates a Context
as state for the pseudorandom number generator, required for key exchange operations
randomBytes :: Context -> Int -> (ByteString, Context) Source #
Generate pseudorandom bytes from the Context.