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