On Sunday, 13 December 2015 at 12:44:06 UTC, Marc Schütz wrote:
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]).


The structs themselves do not but the alias at the beginning of the file make sure they do.

alias MurmurHash3_x86_32 = Digester!SMurmurHash3_x86_32;
alias MurmurHash3_x86_128 = Digester!SMurmurHash3_x86_128;
alias MurmurHash3_x64_128 = Digester!SMurmurHash3_x64_128;

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]);

I suspect this as well although I haven't tested.
I'll add more tests and add the missing logic if needed.

  • MurmurHash3 Guillaume Chatelet via Digitalmars-d-announce
    • Re: MurmurHash3 Brad Anderson via Digitalmars-d-announce
    • Re: MurmurHash3 Ilya via Digitalmars-d-announce
    • Re: MurmurHash3 Ilya via Digitalmars-d-announce
      • Re: MurmurHash3 Guillaume Chatelet via Digitalmars-d-announce
        • Re: MurmurHash3 Ilya via Digitalmars-d-announce
          • Re: MurmurH... Guillaume Chatelet via Digitalmars-d-announce
            • Re: Mu... Marc Schütz via Digitalmars-d-announce
              • Re... Guillaume Chatelet via Digitalmars-d-announce
                • ... Guillaume Chatelet via Digitalmars-d-announce
                • ... Guillaume Chatelet via Digitalmars-d-announce
                • ... Marc Schütz via Digitalmars-d-announce

Reply via email to