[Random] allow drgNew to be run in any MonadRandom directly.

this allow cascading, create a DRG from another DRG
This commit is contained in:
Vincent Hanquez 2015-06-19 11:05:54 +01:00
parent 0d2290a4a1
commit 0b6b2d661c

View File

@ -26,8 +26,10 @@ import Data.ByteArray (ScrubbedBytes)
import Crypto.Internal.Imports
-- | Create a new DRG from system entropy
drgNew :: IO ChaChaDRG
drgNew = initialize <$> (getEntropy 40 :: IO ScrubbedBytes)
drgNew :: MonadRandom randomly => randomly ChaChaDRG
drgNew = do
b <- getRandomBytes 40
return $ initialize (b :: ScrubbedBytes)
-- | Create a new DRG from 5 Word64.
--