OT using crc32 as key for objects
dbeckham-memcached at dealnews.com
Fri Oct 6 14:18:47 UTC 2006
Why do you want to avoid using a md5 or sha1 hash? Those are the best
tools for this job and the quickest way to accomplish your goal. If
speed is a concern, then your question should be can md5 or sha1 perform
at the speed your application is going to need it to perform at. And
the best way for you to answer that is to performance test your code.
I think the overkill might be the time you are putting into coming up
with a solution that already has had an answer for decades.
Jed Reynolds wrote:
> I'd like to avoid using truncated MD5 or SHA1 hashes of queries as
> that seems overkill. Using a crc32 of a query is more risky but still
> improbable to collide within a hundred thousand queries, but I don't
> know the math that well. It would seem to me that concatenating the
> crc32s of a query and a salted version of the query would very likely
> yield a pretty unique key for a sql query. By the same logic,
> concatenating the crc32 of the base64 encoding of a query seems
> reasonably safe, too.
More information about the memcached