The entropy package

[ Tags: bsd3, cryptography, data, library ] [ Propose Tags ]

A platform independent 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]


Versions 0.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
Dependencies base (>=4.8 && <5), bytestring, unix [details]
License BSD3
Copyright Thomas DuBuisson <>
Author Thomas DuBuisson <>
Maintainer Thomas DuBuisson <>
Category Data, Cryptography
Home page
Bug tracker
Source repo head: git clone
Uploaded Sun Dec 31 19:18:05 UTC 2017 by ThomasDuBuisson
Updated Mon Jan 1 09:30:07 UTC 2018 by HerbertValerioRiedel to revision 1   [What is this?]
Distributions Arch:0.3.8, Debian:0.3.7, Fedora:0.3.7, FreeBSD:0.3.7, LTSHaskell:0.3.8, NixOS:0.4, Stackage:0.3.8, openSUSE:0.3.8
Downloads 97835 total (440 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-01-01 [all 1 reports]
Hackage Matrix CI





Build for the HaLVM


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


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees

Readme for entropy-0.4

[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