diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-03-03 15:44:01 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-03-03 15:49:51 -0400 |
commit | fc39ddb96af70c14c5de739408b03a14ef2053bf (patch) | |
tree | d81aedc573531e1e0e45d110a1eae1e12c296d21 /ByteStrings.hs | |
parent | 0e5dac41b5d08d72c3799d9cc52de0ed95c2e870 (diff) | |
download | keysafe-fc39ddb96af70c14c5de739408b03a14ef2053bf.tar.gz |
Updated to use raaz-0.1.1.
This commit was sponsored by John Peloquin on Patreon.
Diffstat (limited to 'ByteStrings.hs')
-rw-r--r-- | ByteStrings.hs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/ByteStrings.hs b/ByteStrings.hs index cecf617..90b42f0 100644 --- a/ByteStrings.hs +++ b/ByteStrings.hs @@ -1,5 +1,3 @@ -{-# OPTIONS_GHC -fno-warn-orphans #-} - {- Copyright 2016 Joey Hess <id@joeyh.name> - - Licensed under the GNU AGPL version 3 or higher. @@ -9,8 +7,6 @@ module ByteStrings where import qualified Data.ByteString as B import qualified Raaz -import Control.Monad -import Data.Word allByteStringsOfLength :: Int -> [B.ByteString] allByteStringsOfLength = go [] @@ -34,9 +30,8 @@ chunkByteString n = go [] let (h, t) = B.splitAt n b in go (h:cs) t -instance Raaz.Random Word8 - -randomByteStringOfLength :: Int -> Raaz.SystemPRG -> IO B.ByteString -randomByteStringOfLength n prg = B.pack <$> replicateM n randbyte +randomByteStringOfLength :: Int -> IO B.ByteString +randomByteStringOfLength n = Raaz.securely gen where - randbyte = Raaz.random prg :: IO Word8 + gen :: Raaz.RandM B.ByteString + gen = Raaz.randomByteString (Raaz.BYTES n) |