1

Possible Duplicate:
php hash form string to integer

I am looking to hash a url like http://example.com to a integer hash, small in size preferably. I would like to know if there is any built-in php functions that can do that.

The purpose for this is for speed in my mysql database for other operations inside mysql when I am comparing this hashes.

Community
  • 1
  • 1
  • 1
    Wouldn't adding indexes on the relevant columns in MySql be a better ID. That should normally give you the speedup you need. – AVee Sep 21 '11 at 16:08
  • @AVee The thing is that I will make a lot of compares with that url, the url being a char will be slower then an integer, so my idea was to hash the url and make the comparisons between the hashes in mysql. – Georges Chitiga Sep 21 '11 at 16:26
  • @Jon A maximum length of 10 would be great. – Georges Chitiga Sep 21 '11 at 16:26
  • 1
    The FNV hash (http://isthe.com/chongo/tech/comp/fnv/) may be what you want. – rossum Sep 21 '11 at 16:41
  • @rossum Thank you, this is perfect for me. For I even found a PHP implementation here http://code.google.com/p/boyanov/wiki/FNVHash – Georges Chitiga Sep 21 '11 at 16:48

0 Answers0