Hash algorithms implemented in PHP

The concept: Hash Table (HashTable), also known as hash table, to access the record is mapped to a location in the array of keyword Key, in order to speed up the search. This array is called Hash function mapping function, called Hash table storage record

Direct access Conormal

M is the size divided by the number of Hash Table I with the keyword k: h (k) = k mod h

Rounding the product of Method

With key k by a constant A (0 <A <1), and the fractional portion extracted kA. This value is then multiplied with the Hash table size m, and then taking the integer part can be: h (k) = floor (m * (KA mod 1))

Classic Hash algorithm Times33

  • Hash tables with PHP hash1

  • Hash table clash (zipper method) hash2

Original: Large columns  with PHP Hash Algorithm


Guess you like

Origin www.cnblogs.com/wangziqiang123/p/11618222.html