cardano-crypto-class-2.2.0.0: Type classes abstracting over cryptography primitives for Cardano
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Crypto.Seed

Description

Seeds for key generation.

Synopsis

Documentation

data Seed Source #

A seed contains a finite number of bytes, and is used for seeding cryptographic algorithms including key generation.

This is not itself a PRNG, but can be used to seed a PRNG.

Instances

Instances details
Monoid Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

Methods

memptySeed Source #

mappendSeedSeedSeed Source #

mconcat ∷ [Seed] → Seed Source #

Semigroup Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

Methods

(<>)SeedSeedSeed Source #

sconcatNonEmpty SeedSeed Source #

stimesIntegral b ⇒ b → SeedSeed Source #

Show Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

Methods

showsPrecIntSeedShowS Source #

showSeedString Source #

showList ∷ [Seed] → ShowS Source #

NFData Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

Methods

rnfSeed → () Source #

Eq Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

Methods

(==)SeedSeedBool Source #

(/=)SeedSeedBool Source #

NoThunks Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

Constructing seeds

mkSeedFromBytesByteStringSeed Source #

Construct a Seed deterministically from a number of bytes.

getSeedBytesSeedByteString Source #

Extract the full bytes from a seed. Note that this function does not guarantee that the result is sufficiently long for the desired seed size!

readSeedFromSystemEntropyWordIO Seed Source #

Obtain a Seed by reading n bytes of entropy from the operating system.

splitSeedWordSeedMaybe (Seed, Seed) Source #

Split a seed into two smaller seeds, the first of which is the given number of bytes large, and the second is the remaining. This will fail if not enough bytes are available. This can be chained multiple times provided the seed is big enough to cover each use.

expandSeedHashAlgorithm h ⇒ proxy h → Seed → (Seed, Seed) Source #

Expand a seed into a pair of seeds using a cryptographic hash function (in the role of a crypto PRNG). The whole input seed is consumed. The output seeds are the size of the hash output.

Using seeds

getBytesFromSeedWordSeedMaybe (ByteString, Seed) Source #

Get a number of bytes from the seed. This will fail if not enough bytes are available. This can be chained multiple times provided the seed is big enough to cover each use.

getBytesFromSeedTWordSeed → (ByteString, Seed) Source #

A flavor of getBytesFromSeed that throws SeedBytesExhausted instead of returning Nothing.

runMonadRandomWithSeedSeed → (∀ m. MonadRandom m ⇒ m a) → a Source #

Run an action in MonadRandom deterministically using a seed as a finite source of randomness. Note that this is not a PRNG, so like with getBytesFromSeed it will fail if more bytes are requested than are available.

So this is only really suitable for key generation where there is a known upper bound on the amount of entropy that will be requested.