real java version implementation of cityhash
mvn clean install
this is motivated by CityHash-For-Java
but seems the author did NOT strictly follow the google cityhash algorithm. And it will generate different output result for some input with python
and c++
version. (ignore this if you don't care about cross-language)
>>> from cityhash import CityHash64WithSeed
>>> input = "1234567890"
>>> hash = CityHash64WithSeed(input)
>>> print("%s\t%x\t%d" % (input, hash, hash))
1234567890 4fabad57d84b98c1 5740872742816422081
public static void main(String[] args) {
CityHash hasher = new CityHash();
String s1 = "1234567890";
long hash1 = hasher.hash64WithSeed(s1, 0);
System.out.printf("%s\t%s\t%d\n", s1, Long.toHexString(hash1), hash1);
}
1234567890 4fabad57d84b98c1 5740872742816422081