spaolacci / murmur3

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

add seed to constructor of all hash (New32, New64, New128) #10

Closed huydx closed 6 years ago

huydx commented 8 years ago

Current implementation lack of capability to seed. I've wonder between change the constructor interface (lacking backward compability) and new interface like New32WithSeed, but lacking of seed capability seems to be not fit with original implementation, so change the original constructor seems to be better.

@spaolacci please take a look.

Thank you in advance.

huydx commented 8 years ago

all tests passed

➜  murmur3 git:(master) go test

hel|lo|
hel|lo, wo|rld|
19 |Jan 20|38 at 3:14:0|7 AM|
The| quick| brown fox j|umps over the lazy dog.|
PASS
ok      github.com/spaolacci/murmur3    0.006s
spaolacci commented 7 years ago

API can't indeed be broken in any non backward compatible way, that's a kind of string commitment, but new extended constructors can easily call original ones. (side point - reseters must also carefully be kept unchanged in their behavior).

Please tell me if 4ec5a0f56d4fc178129a8433576bf6f2fe672a9e fix the API for you.

Thanks.

huydx commented 6 years ago

thanks @spaolacci