Skip to content

Probably bug in KeysetTest.cpp #20

@GoogleCodeExporter

Description

@GoogleCodeExporter
Trying to port C++ implementation to C# I found a funny bug that confused me 
when I compared the hashes between both implementations.

The hard coded value for the MurMurHash3_x86_32 (end probably for the rest of 
methods) is not correct because of the bug in KeysetTest.cpp.

The problem is in the following piece of code (lines 28-33):

 for(int i = 0; i < 256; i++)
  {
    key[i] = (uint8_t)i;

    hash(key,i,256-i,&hashes[i*hashbytes]);
  }

At first iteration the first element of key array is set to "0" and the length 
of the key array is 1, but as far as i is sent to hash function as len 
parameter, it is set to 0.

The correct code should look like:

    hash(key,i+1,256-i,&hashes[i*hashbytes]);

and the resulting hash is 0xDBFB92BE.

Original issue reported on code.google.com by [email protected] on 28 Feb 2013 at 4:09

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions