[ANNOUNCE] First release of crypto-conduit

Hello! I'm pleased to announce the first release of crypto-conduit [1]! The crypto-api [2] package provides APIs for many cryptographic operations, such as cryptographic hashes and block ciphers. This new crypto-conduit package allows you to use many of these operations with conduits [3], giving you safe I/O using constant memory and no leaks. As an example, here's how you could get the SHA1 hash a file: import Crypto.Conduit -- from crypto-conduit import Crypto.Hash.SHA1 (SHA1) -- from cryptohash import Data.Conduit -- from conduit import Data.Conduit.Binary (sourceFile) -- from conduit main = do hash <- runResourceT $ sourceFile "my-file" $$ sinkHash print (hash :: SHA1) The code snippet above, despite having only "sourceFile ... $$ sinkHash" on its core, guarantees that the file handle is not kept open and uses a constant amount of memory. Sweet! Please break this package! Although it comes with a test suite, it has just seen the light of the day. Cheers, =) [1] http://hackage.haskell.org/package/crypto-conduit [2] http://hackage.haskell.org/package/crypto-api [3] http://hackage.haskell.org/package/conduit -- Felipe.

great! I am wondering if you can provide even higher-level APIs for the common case: hash <- runResourceT $ hashFile "my-file" and possibly something that runs the ResourceT transformer: hash <- runHashFile "my-file" On Sat, Jan 7, 2012 at 12:16 AM, Felipe Almeida Lessa < felipe.lessa@gmail.com> wrote:
Hello!
I'm pleased to announce the first release of crypto-conduit [1]! The crypto-api [2] package provides APIs for many cryptographic operations, such as cryptographic hashes and block ciphers. This new crypto-conduit package allows you to use many of these operations with conduits [3], giving you safe I/O using constant memory and no leaks.
As an example, here's how you could get the SHA1 hash a file:
import Crypto.Conduit -- from crypto-conduit import Crypto.Hash.SHA1 (SHA1) -- from cryptohash import Data.Conduit -- from conduit import Data.Conduit.Binary (sourceFile) -- from conduit
main = do hash <- runResourceT $ sourceFile "my-file" $$ sinkHash print (hash :: SHA1)
The code snippet above, despite having only "sourceFile ... $$ sinkHash" on its core, guarantees that the file handle is not kept open and uses a constant amount of memory. Sweet!
Please break this package! Although it comes with a test suite, it has just seen the light of the day.
Cheers, =)
[1] http://hackage.haskell.org/package/crypto-conduit [2] http://hackage.haskell.org/package/crypto-api [3] http://hackage.haskell.org/package/conduit
-- Felipe.
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

On Sat, Jan 7, 2012 at 8:06 AM, Greg Weber
I am wondering if you can provide even higher-level APIs for the common case:
hash <- runResourceT $ hashFile "my-file"
and possibly something that runs the ResourceT transformer:
hash <- runHashFile "my-file"
That's dead simple to add, I just wonder which ones should be added (since triplicating the whole API wouldn't be fun). So you're assuming that hashing is the most common case of the library, right? Now, having 'hashFile' inside ResourceT isn't terribly useful and if the user needs it, it's trivial to implement, so I'm thinking of just exporting a single new function: hashFile :: (MonadIO m, Hash ctx d) => FilePath -> m d I'll include it on the next version. =) Cheers, -- Felipe.

And while we're at it, some code to deal with the cumbersome decoding of
those hash objects would be nice!
Cheers,
Aristid
Am 07.01.2012 11:07 schrieb "Greg Weber"
great!
I am wondering if you can provide even higher-level APIs for the common case:
hash <- runResourceT $ hashFile "my-file"
and possibly something that runs the ResourceT transformer:
hash <- runHashFile "my-file"
On Sat, Jan 7, 2012 at 12:16 AM, Felipe Almeida Lessa < felipe.lessa@gmail.com> wrote:
Hello!
I'm pleased to announce the first release of crypto-conduit [1]! The crypto-api [2] package provides APIs for many cryptographic operations, such as cryptographic hashes and block ciphers. This new crypto-conduit package allows you to use many of these operations with conduits [3], giving you safe I/O using constant memory and no leaks.
As an example, here's how you could get the SHA1 hash a file:
import Crypto.Conduit -- from crypto-conduit import Crypto.Hash.SHA1 (SHA1) -- from cryptohash import Data.Conduit -- from conduit import Data.Conduit.Binary (sourceFile) -- from conduit
main = do hash <- runResourceT $ sourceFile "my-file" $$ sinkHash print (hash :: SHA1)
The code snippet above, despite having only "sourceFile ... $$ sinkHash" on its core, guarantees that the file handle is not kept open and uses a constant amount of memory. Sweet!
Please break this package! Although it comes with a test suite, it has just seen the light of the day.
Cheers, =)
[1] http://hackage.haskell.org/package/crypto-conduit [2] http://hackage.haskell.org/package/crypto-api [3] http://hackage.haskell.org/package/conduit
-- Felipe.
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Sat, Jan 7, 2012 at 9:12 AM, Aristid Breitkreuz
And while we're at it, some code to deal with the cumbersome decoding of those hash objects would be nice!
I'm sorry, but what do you mean by "cumbersome decoding"? Cheers, =) -- Felipe.

Well, how do you get a ByteString from the hash object?
Aristid
Am 07.01.2012 13:04 schrieb "Felipe Almeida Lessa"
On Sat, Jan 7, 2012 at 9:12 AM, Aristid Breitkreuz
wrote: And while we're at it, some code to deal with the cumbersome decoding of those hash objects would be nice!
I'm sorry, but what do you mean by "cumbersome decoding"?
Cheers, =)
-- Felipe.
participants (3)
-
Aristid Breitkreuz
-
Felipe Almeida Lessa
-
Greg Weber