entropy: A platform independent entropy source

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.



A mostly platform independent (not GHCJS) method to obtain cryptographically strong entropy (RDRAND, urandom, CryptAPI, and patches welcome) Users looking for cryptographically strong (number-theoretically sound) PRNGs should see the DRBG package too.

[Skip to ReadMe]


Versions0.1, 0.2, 0.2.1, 0.2.2,,,,, 0.3, 0.3.1, 0.3.2, 0.3.3, 0.3.4,, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.4, 0.4.1,,,,,
Change logNone available
Dependenciesbase (>=4.8 && <5), bytestring, unix [details]
CopyrightThomas DuBuisson <thomas.dubuisson@gmail.com>
AuthorThomas DuBuisson <thomas.dubuisson@gmail.com>
MaintainerThomas DuBuisson <thomas.dubuisson@gmail.com>
CategoryData, Cryptography
Home pagehttps://github.com/TomMD/entropy
Bug trackerhttps://github.com/TomMD/entropy/issues
Source repositoryhead: git clone https://github.com/TomMD/entropy
UploadedSat Sep 22 20:31:01 UTC 2018 by ThomasDuBuisson





Build for the HaLVM


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainers' corner

For package maintainers and hackage trustees

Readme for entropy-

[back to package description]


This package allows Haskell users to easily acquire entropy for use in critical security applications by calling out to either windows crypto api, unix/linux's /dev/urandom. Hardware RNGs (currently RDRAND, patches welcome) are supported via the hardwareRNG function.

If you wish to obtain an XOR of the hardware and system RNG consider:

import           Data.Bits (xor)
import qualified Data.ByteString as B
import qualified Control.Exception as X

xorRNG sz = do hw  <- hardwareRNG sz
               h   <- openHandle
               sys <- hGetEntropy h `X.finally` closeHandle h
               pure $ B.pack $ B.zipWith xor hw sys

This package supports Windows, {li,u}nix, QNX, and has preliminary support for HaLVM.

Typically tested on Linux and OSX - testers are as welcome as patches.

Build Status