The review of std.hash package

Christophe Travert travert at phare.normalesup.org
Wed Aug 8 07:16:40 PDT 2012


"Chris Cain" , dans le message (digitalmars.D:174466), a écrit :
> On Wednesday, 8 August 2012 at 13:38:26 UTC, 
> travert at phare.normalesup.org (Christophe Travert) wrote:
>> I think the question is: is std.hash going to contain only
>> message-digest algorithm, or could it also contain other hash 
>> functions?
>> I think there is enough room in a package to have both 
>> message-digest
>> algorithm and other kinds of hash functions.
> 
> Even if that were the case, I'd say they should be kept separate. 
> Cryptographic hash functions serve extremely different purposes 
> from regular hash functions. There is no reason they should be 
> categorized the same.

They should not be categorized the same. I don't expect a regular hash 
function to pass the isDigest predicate. But they have many 
similarities, which explains they are all called hash functions. There 
is enough room in a package to put several related concepts!

Here, we have a package for 4 files, with a total number of line that is 
about one third of the single std.algorithm file (which is probably too 
big, I conceed). There aren't hundreds of message-digest functions to 
add here.

If it where me, I would have the presently reviewed module std.hash.hash 
be called std.hash.digest, and leave room here for regular hash 
functions. In any case, I think regular hash HAVE to be in a std.hash 
module or package, because people looking for a regular hash function 
will look here first.




More information about the Digitalmars-d mailing list