rastogitanuj / smhasher

Automatically exported from code.google.com/p/smhasher
0 stars 0 forks source link

Two different byte arrays produce the same hash? #35

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use the C# version: https://gist.github.com/automatonic/3725443
2. Use MurMurHash3 to generate hash for byte[] equivalent of "0,0,0,15,7,"
3. Use MurMurHash3 to generate hash for byte[] equivalent of "0,3,13,25,12,"

What is the expected output? What do you see instead?
the expected output is two different hash values. What I see instead is that 
they both generate a hash value of 1090836093

What version of the product are you using? On what operating system?
Use the C# version: https://gist.github.com/automatonic/3725443
Windows 7 Enterprise 64-bit (but running my .Net in 32-bit)

Please provide any additional information below.
I thought that given two different byte arrays I would get two different hash 
values. Am I wrong?

Original issue reported on code.google.com by humphrey...@gmail.com on 16 Dec 2015 at 11:58

GoogleCodeExporter commented 8 years ago
To get the bye[] from string I used the following code:

        public static int GetHash(string uniqueString)
        {
            byte[] input = Encoding.GetBytes(uniqueString);
            using (var stream = new MemoryStream(input))
                return Hash(stream);
        }

Original comment by humphrey...@gmail.com on 16 Dec 2015 at 11:59