Initial commit
This commit is contained in:
commit
c101616e62
309 changed files with 53937 additions and 0 deletions
22
bundled/Crypto/Random/Entropy.hs
Normal file
22
bundled/Crypto/Random/Entropy.hs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- |
|
||||
-- Module : Crypto.Random.Entropy
|
||||
-- License : BSD-style
|
||||
-- Maintainer : Vincent Hanquez <vincent@snarc.org>
|
||||
-- Stability : experimental
|
||||
-- Portability : Good
|
||||
--
|
||||
module Crypto.Random.Entropy
|
||||
( getEntropy
|
||||
) where
|
||||
|
||||
import Data.Maybe (catMaybes)
|
||||
import Crypto.Internal.ByteArray (ByteArray)
|
||||
import qualified Crypto.Internal.ByteArray as B
|
||||
|
||||
import Crypto.Random.Entropy.Unsafe
|
||||
|
||||
-- | Get some entropy from the system source of entropy
|
||||
getEntropy :: ByteArray byteArray => Int -> IO byteArray
|
||||
getEntropy n = do
|
||||
backends <- catMaybes `fmap` sequence supportedBackends
|
||||
B.alloc n (replenish n backends)
|
||||
Loading…
Add table
Add a link
Reference in a new issue