summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonEkblad <>2013-12-07 01:09:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2013-12-07 01:09:00 (GMT)
commit5987857f63a237e13d6a137fd961ca25029357aa (patch)
treec2d62b87d81f755636406d6e28f8a531fb572fee
parent4ca21842601a26dc9e7f4dd8f12a8f4dc0fbd14a (diff)
version 0.2.50.2.5
-rw-r--r--Crypto/Threefish/Skein/StreamCipher.hs13
-rw-r--r--threefish.cabal2
2 files changed, 7 insertions, 8 deletions
diff --git a/Crypto/Threefish/Skein/StreamCipher.hs b/Crypto/Threefish/Skein/StreamCipher.hs
index dba3067..117fed3 100644
--- a/Crypto/Threefish/Skein/StreamCipher.hs
+++ b/Crypto/Threefish/Skein/StreamCipher.hs
@@ -32,14 +32,13 @@ init256 (Block256 k) (Block256 n) =
stream256 :: Skein256Ctx -> [BS.ByteString]
stream256 (Skein256Ctx c) =
- unsafePerformIO $ go 0
+ unsafePerformIO $ withForeignPtr c $ go 0
where
- go n = unsafeInterleaveIO $ do
- bs <- withForeignPtr c $ \ctx -> do
- allocaBytes 1024 $ \ptr -> do
- skein256_output ctx n (n+32) ptr
- BS.packCStringLen (castPtr ptr, 1024)
- bss <- go (n+32)
+ go n ctx = unsafeInterleaveIO $ do
+ bs <- allocaBytes 1024 $ \ptr -> do
+ skein256_output ctx n (n+32) ptr
+ BS.packCStringLen (castPtr ptr, 1024)
+ bss <- go (n+32) ctx
return $ bs : bss
keystream256 :: Key256 -> Nonce256 -> [BS.ByteString]
diff --git a/threefish.cabal b/threefish.cabal
index d9a804a..c34bc7b 100644
--- a/threefish.cabal
+++ b/threefish.cabal
@@ -1,5 +1,5 @@
name: threefish
-version: 0.2.4
+version: 0.2.5
synopsis: The Threefish block cipher and the Skein hash function for Haskell.
description: Implements 256 and 512 bit variants of Threefish and Skein. Skein is usable as a "normal" hash function as well as in Skein-MAC, as a cryptographically secure PRNG, as a stream cipher and as a key derivation function, all implemented according to the specifications of the Skein 1.3 paper.
homepage: http://github.com/valderman/threefish