Good checksum to speed up searches
I want to speed up the search of my application by creating an checksum index of my strings.
Is CRC32 good enough? I'm not using it for security. Just as a way to represent a string as a hashed(Integer/Long) in开发者_如何学Godex.
You're looking for a hash code, not a checksum. CRC32 should be fine though, but not very efficient. Also have a look at Adler32 (used by zlib), which is faster to calculate.
See also Hash function
Are you trying to reinvent the wheel, or in this case a hash table?
CRC32 is for calculating checksums, it's not designed to be fast hash function, it's designed to detect errors (changes) in files. Four your needs, you might rather want to look at non-cryptographic hash functions.
精彩评论