spaolacci / murmur3

Native MurmurHash3 Go implementation
BSD 3-Clause "New" or "Revised" License
947 stars 127 forks source link

Sum() method doesn't work after small Write()s #6

Closed muirdm closed 9 years ago

muirdm commented 9 years ago

I expect this code to print out the hash value in byte slice form, but it produces a slice with all zeros:

h := murmur3.New64()
h.Write([]byte{1, 2, 3, 4})

fmt.Println(h.Sum(nil))
// Output: [0 0 0 0 0 0 0 0]

fmt.Println(h.Sum64())
// Output: 720734999560851427