-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A platform independent entropy source -- -- 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. @package entropy @version 0.4 -- | Obtain entropy from system sources or x86 RDRAND when available. -- -- Currently supporting: -- --
-- let fastRandom nr = maybe (getEntropy nr) pure =<< getHardwareEntropy nr ---- -- The old, <0.4, behavior is possible using xor -- from Bits: -- --
-- let oldRandom nr = -- do hwRnd maybe (replicate nr 0) BS.unpack <$ getHardwareEntropy nr -- sysRnd BS.unpack <$ getEntropy nr -- pure $ BS.pack $ zipWith xor sysRnd hwRnd ---- -- A less maliable mixing can be accomplished by replacing xor -- with a composition of concat and cryptographic hash. getHardwareEntropy :: Int -> IO (Maybe ByteString) -- | Handle for manual resource management data CryptHandle -- | Open a CryptHandle openHandle :: IO CryptHandle -- | Read random data from a CryptHandle hGetEntropy :: CryptHandle -> Int -> IO ByteString -- | Close the CryptHandle closeHandle :: CryptHandle -> IO ()