From fc39ddb96af70c14c5de739408b03a14ef2053bf Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 3 Mar 2017 15:44:01 -0400 Subject: Updated to use raaz-0.1.1. This commit was sponsored by John Peloquin on Patreon. --- Storage.hs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'Storage.hs') diff --git a/Storage.hs b/Storage.hs index c481d77..feb5791 100644 --- a/Storage.hs +++ b/Storage.hs @@ -26,7 +26,6 @@ import Control.Concurrent.Async import qualified Data.Set as S import System.Random import System.Random.Shuffle -import qualified Raaz networkStorageLocations :: Maybe LocalStorageDirectory -> StorageLocations networkStorageLocations = StorageLocations . serverList @@ -171,25 +170,24 @@ storeChaff :: HostName -> Port -> Maybe Seconds -> IO () storeChaff hn port delayseconds = forever $ do say $ "Sending chaff to " ++ hn ++ " (press ctrl-c to stop)" say "Legend: + = successful upload, ! = upload failure" - prg <- Raaz.newPRG () :: IO Raaz.SystemPRG - randomname <- randomByteStringOfLength 128 prg + randomname <- randomByteStringOfLength 128 -- It's ok the use the testModeTunables here because -- the randomname is not something that can be feasibly guessed. -- Prefix "random chaff" to the name to avoid ever using a name -- that a real user might want to use. let sis = shareIdents testModeTunables (Name $ "random chaff:" <> randomname) AnyGpgKey - mapConcurrently (go sis prg) + mapConcurrently (go sis) [1..totalObjects (shareParams testModeTunables)] where server = networkStorage Untrusted Nothing $ Server (ServerName hn) [ServerAddress hn port] "chaff server" objsize = objectSize defaultTunables * shareOverhead defaultTunables maxmsdelay = ceiling $ 1000000 * fromMaybe 0 delayseconds - go sis prg n = do + go sis n = do msdelay <- getStdRandom (randomR (0, maxmsdelay)) delay msdelay - b <- randomByteStringOfLength objsize prg + b <- randomByteStringOfLength objsize let share = Share 0 (StorableObject b) let (is, sis') = nextShareIdents sis let i = S.toList is !! (n - 1) @@ -197,7 +195,7 @@ storeChaff hn port delayseconds = forever $ do case r of StoreSuccess -> progress "+" _ -> progress "!" - go sis' prg n + go sis' n -- | Shuffles the list, keeping Recommended first, then -- Alternate, and finally Untrusted. -- cgit v1.2.3