packages feed

entropy 0.1 → 0.2

raw patch · 2 files changed

+12/−21 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

System/Entropy.hs view
@@ -16,12 +16,10 @@ 	, closeHandle 	) where -import Control.Exception as X import Control.Monad (liftM) import Data.ByteString as B import Data.ByteString.Lazy as L-import System.IO (openFile, hClose, IOMode(..), Handle)-import qualified Control.Exception as X+import System.IO (openFile, hClose, IOMode(..), Handle, withBinaryFile)  #if defined(isWindows) {- C example for windows rng - taken from a blog, can't recall which one but thank you!@@ -98,13 +96,11 @@ -- on platforms without a secure RNG! getEntropy :: Int -> IO B.ByteString getEntropy n = do-  X.catch (do-            h <- cryptAcquireCtx-            bs <- cryptGenRandom h n-            let !bs' = bs-            cryptReleaseCtx h-            return bs')-    (\(e :: X.IOException) -> return B.empty)+   h <- cryptAcquireCtx+   bs <- cryptGenRandom h n+   let !bs' = bs+   cryptReleaseCtx h+   return bs'  -- |Open a handle from which random data can be read openHandle :: IO CryptHandle@@ -142,13 +138,6 @@ -- this entropy is considered "cryptographically secure" but not true -- entropy. getEntropy :: Int -> IO B.ByteString-getEntropy n = -  X.catch (do-            h <- openFile source ReadMode-            bs <- B.hGet h n-            let !bs' = bs-            hClose h-            return bs')-  (\(e :: X.IOException) -> return B.empty)+getEntropy n = withBinaryFile source ReadMode (`B.hGet` n) #endif 
entropy.cabal view
@@ -1,12 +1,14 @@ name:           entropy-version:        0.1+version:        0.2 license:        BSD3 license-file:   LICENSE copyright:      Thomas DuBuisson <thomas.dubuisson@gmail.com> author:         Thomas DuBuisson <thomas.dubuisson@gmail.com> maintainer:     Thomas DuBuisson <thomas.dubuisson@gmail.com>-description:    A platform independent method to obtain cryptographically strong entropy (/dev/urandom on Linux, CryptAPI on Windows, patches welcome)-                Users looking for cryptographically strong (number-theoretically sound) PRNGs should see the 'DRBG' package too!+description:    A platform independent method to obtain cryptographically strong entropy +                (urandom on Linux, CryptAPI on Windows, patches welcome). +                Users looking for cryptographically strong (number-theoretically+                sound) PRNGs should see the 'DRBG' package too! synopsis:       A platform independent entropy source category:       Data, Cryptography homepage:       http://trac.haskell.org/crypto-api/wiki