MurmurHash3
Marc Schütz via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Sun Dec 13 04:44:06 PST 2015
On Saturday, 12 December 2015 at 20:12:49 UTC, Guillaume Chatelet
wrote:
> On Saturday, 12 December 2015 at 02:59:21 UTC, Ilya wrote:
>> Current version is suitable for arrays but not ranges or types.
>>
>> Few examples:
>> 1. Compute hash of ulong.
>> 2. Compute hash of all elements in matrix column (element are
>> in different arrays).
>>
>> I have created output range API draft
>> http://dpaste.dzfl.pl/a24050042758
>>
>> Ilya
>
> I created https://github.com/gchatelet/murmurhash3_d and
> updated the code a bit.
> It conforms to the digest template interface, allows pushing
> ulong[2] and accept ranges.
>
> PR welcome :)
AFAICS this doesn't conform to the digest interface. For example,
there should be a `finish` method that returns the hash as a
static array (see the ExampleDigest [1]). More importantly, I
believe your `put()` implementation only works if it is fed the
entire data at once. I haven't tested it, but I believe that the
following two calls will have a different result, while they
should result in the same hash:
hash.put([1,2,3,4,5,6]);
vs
hash.put([1,2,3]);
hash.put([4,5,6]);
[1] http://dlang.org/phobos/std_digest_digest.html#.ExampleDigest
More information about the Digitalmars-d-announce
mailing list