Skip to content

Latest commit

 

History

History
42 lines (28 loc) · 1.4 KB

README.md

File metadata and controls

42 lines (28 loc) · 1.4 KB

PHP-xxHash

A PHP extension to add support for the xxHash fast hashing algorithm.

xxHash is an Extremely fast Hash algorithm, running at RAM speed limits. It successfully completes the SMHasher test suite which evaluates collision, dispersion and randomness qualities of hash functions.

PHP7 Compatability

Please note at the moment the master branch should be used for PHP 5.x and develop branch should be used for PHP 7.x

Installation Instructions

   phpize
   ./configure --enable-xxhash
   make
   sudo make install

Don't forget to load the extension in via php.ini or the like.

Usage Instructions

Upon installation and enabling the extension within php.ini the following two new functions will be available to you:

string xxhash64(string $data[, int $seed[, bool $return_as_decimal]]);
string xxhash32(string $data[, int $seed[, bool $return_as_decimal]]);

In both cases a string will be returned, representing the digest (hash) of the $data input.
When $return_as_decimal is true, return decimal string instead of hexadecimal.

Credits

  • Original implementation of php-xxhash by Stuart Herbert.
  • xxHash by Yann Collet.

Licence

BSD 2-clause license.