[Haskell-cafe] ANNOUNCE: hs-cryptohash 0.4
Vincent Hanquez
tab at snarc.org
Fri Jul 2 05:16:10 EDT 2010
On Fri, Jul 02, 2010 at 12:55:03PM +1000, Ivan Miljenovic wrote:
> On 1 July 2010 17:25, Vincent Hanquez <tab at snarc.org> wrote:
> > The main reason for this library is the lack of incremental api exposed by
> > current digest libraries, and filling the void about some missing digest
> > algorithms; Also the speed comes as a nice bonus.
>
> Can you explain what you mean by "incremental API"?
The incremental API is the init/update/finalize functions where you can call
update as many time as you need, instead of a single function "hash" where you
need to hash all your data in one-go.
It's necessary in my case since i receive chunks of data to be hashed from the
network, and I don't want to carry a buffer of data (with potential security
issues), until i can hash everything.
The few existing packages that exposes the incremental API, usually do it
in the IO monad; cryptohash do it purely, creating a new context as it get updated.
(this has a cost but remains fast globally with the C implementation)
i.e.
update : ctx -> bytestring -> IO ()
becomes:
update : ctx -> bytestring -> ctx
> (I'm not going to comment on the API decisions as I've never used any
> hashing functionality in my code and I thus wouldn't know what is good
> or bad.)
>
> First of all, Hackage couldn't seem to build it:
> http://hackage.haskell.org/packages/archive/cryptohash/0.4/logs/failure/ghc-6.12
ok, as a disclaimer: this the first time i'm using cabal sdist and uploading
anything to hackage :)
i forgot to add the .h files as extras, hence the build failure.
> Secondly, at the moment even if you disable the testing flag, whilst
> the executable isn't built Cabal still pulls in HUnit as a dependency.
> This can be resolved by putting the build-depends line in the if
> statement (and should maybe put up the top of the executable section
> to make it more obvious):
ok I renamed the flag, and put the build-depends in the conditional.
i'll move the conditional at the beggining in the next iteration of the package
but i forgot before re-uploading the package.
> Oh, and in case it isn't obvious to people, the package name on
> hackage is just "cryptohash", not "hs-cryptohash".
yes, I though that, on hackage prefixing things with hs- would make it a bit redundant.
There's now a 4.0.1 package uploaded on hackage, that should fix most of the problems.
Thanks for the comments !
--
Vincent
More information about the Haskell-Cafe
mailing list