CityHash for pair of strings

98 views
Skip to first unread message

whalebot...@gmail.com

unread,
Oct 12, 2011, 4:58:34 AM10/12/11
to cityhash...@googlegroups.com
I want to use city hash for string pairs. Common recommendation is H((s1,s2))=H(s1)*max(H(S)) + H(s2). Is there some predefinied maxH(S), or how can it be calculated? Some other variants for H((s1,s2))?

Geoff Pike

unread,
Oct 14, 2011, 4:07:57 PM10/14/11
to cityhash-discuss
> I want to use city hash for string pairs. Common recommendation is
> H((s1,s2))=H(s1)*max(H(S)) + H(s2). Is there some predefinied maxH(S), or
> how can it be calculated? Some other variants for H((s1,s2))?

For CityHash64 the return values are in [0, 2^64). For CityHash128
they are in [0, 2^128). And so on.

For a hash of two strings, this should work well:
CityHash64WithSeed(str0, size0, CityHash64(str1, size1)).

Geoff

whalebot...@gmail.com

unread,
Oct 17, 2011, 4:53:43 AM10/17/11
to cityhash...@googlegroups.com
Thanks, that help a lot, about 10% of perfomance

1971 powerChina

unread,
May 6, 2015, 11:56:38 PM5/6/15
to cityhash...@googlegroups.com, whalebot...@gmail.com
Reply all
Reply to author
Forward
0 new messages