[Haskell-cafe] ANNOUNCE: hs-cryptohash 0.4

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Fri Jul 2 21:13:11 EDT 2010

Hash: SHA1

On 7/2/10 20:51 , John Meacham wrote:
> On Fri, Jul 02, 2010 at 08:48:07PM -0400, Brandon S Allbery KF8NH wrote:
>> On 7/2/10 17:24 , Gregory Crosswhite wrote:
>>> The problem with this approach is that the hash context isn't a monoid;  you
>>> can absorb data into the context, but you can't combine two hash contexts to
>>> form a new one.  Thus, the Writer monad won't work for this purpose.
>> No?  The context is simply a String, which is a monoid, and you can combine
>> contexts quite meaningfully before you actually compute the final hash (in
>> fact, that's the whole point!).
> The context isn't a string. it is an intermediate state in the algorithm
> of the hash function. it is usually an opaque binary blob (represented by a
> ByteString) of a size that is on the order of the final hash (unrelated
> to the size of the input).

If you read the example code I posted, the point was how to turn the current
monolithic hash function into a cumulative one by using Writer.  As such,
there's no opaque hash state inside the Writer.  (see `hash . runWriter').

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the Haskell-Cafe mailing list