crypton-2.2.5: Cryptography Primitives
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
PortabilityGood
Safe HaskellNone
LanguageHaskell2010

Crypto.Random.Entropy

Description

 
Synopsis

Documentation

getEntropy :: ByteArray byteArray => Int -> IO byteArray Source #

Get some entropy from the system source of entropy

data EntropyError Source #

The system would not give the entropy it was asked for.

This is the one failure in the library with nothing to fall back on and nothing sensible to return: a key drawn from bytes that are not random is worse than no key. It used to be reported with error and fail, which left a caller no way to tell it from a bug in the library, and no way to say anything useful about it.

Constructors

NoEntropySource

The system offers no source of entropy at all. On Unix that means no getrandom(2), no getentropy(3) and no /dev to read from; a container built from nothing would look like this.

EntropyShort Int Int

The sources between them gave fewer bytes than were asked for, three times over. The two numbers are how many were wanted and how many arrived.

EntropySourceLost String

A source that could be opened once could not be opened again. The string names it.