New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CityHash32 #2

Closed
GoogleCodeExporter opened this Issue Aug 14, 2015 · 4 comments

Comments

Projects
None yet
1 participant
@GoogleCodeExporter
Copy link

GoogleCodeExporter commented Aug 14, 2015

It would be nice to have a 32-bit version for use in e.g. hash table 
implementations on 32-bit systems.

Original issue reported on code.google.com by tib...@google.com on 19 Apr 2011 at 8:05

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Aug 14, 2015

I'm able to run both CityHash64 and CityHash128 perfectly fine on my 32-bit 
system. (Actually, CityHash128 has the same amount of data as the de-facto md5, 
which returns 128-bit.)

Can you provide a more detailed use-case (or sample code) of what you're trying 
to do that the current code won't accommodate?

Original comment by eric.caron on 21 Apr 2011 at 5:48

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Aug 14, 2015

Can I take the higher (or lower) 32-bits and use them as a hash value? Is this 
expected to be as fast as if we implemented a CityHash32 directly?

Original comment by johan.ti...@gmail.com on 21 Apr 2011 at 8:24

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Aug 14, 2015

All the CityHash functions are tuned for 64-bit processors. That said, they 
will run (except for the new ones that use SSE4.2) in 32-bit code. They won't 
be very fast though. You may want to use Murmur or something else in 32-bit 
code.

As far as converting a "n-bit hash function" to a "m-bit hash function" where m 
< n, my understanding is that for any "good" hash function, you can simply 
discard n - m bits and keep m bits. For m= 32, all the CityHash variants should 
work fine with this method.

So, in short, it may make sense to create a CityHash32, but we're probably not 
going to do so.

Original comment by gp...@google.com on 29 Apr 2011 at 5:01

  • Changed state: WontFix
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Aug 14, 2015

Original comment by gp...@google.com on 20 Jun 2013 at 9:59

  • Changed state: Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment