Structure of the memcached KEY

Jed Reynolds lists at benrey.is-a-geek.net
Fri Nov 3 16:46:34 UTC 2006


Brian Moon wrote:
> Steven Grimm wrote:
>> If you use a good hash function like SHA-1, false collisions are
>> basically a nonissue. You're more likely to be killed by a falling
>> airplane while holding a winning lottery ticket than to ever see an
>> SHA-1 collision between valid SQL queries.
>
> I still recommend more than just one SHA-1 or md5 hash.  Maybe both
> concated.  I have had collisions with md5 and sha1.  Sure, its 3 out
> of a couple of million, but it happens.
>
I'm using a hash for my sql queries like this:
$k = "sql://$dbname/".md5( $sql )."/".md5( base64_encode( $sql ));

Jed


More information about the memcached mailing list