开发者

Good checksum to speed up searches

开发者 https://www.devze.com 2023-02-06 13:41 出处:网络
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(Inte

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号