MurmurHash is an algorithm desiged by Austin Appleby.
- Add PHP 7.x/8.0 support.
- Seed parameter can be omitted.
phpize
./configure --enable-murmurhash3
make
sudo make install
Create murmurhash3.ini
in lib dir (for example php 8.0: /etc/php/8.0/mods-available/
):
extension=murmurhash3.so
Finally enable it in PHP:
sudo phpenmod murmurhash3
<?php
// Example
echo murmurhash3('anystring') . PHP_EOL; // default seed usage
echo murmurhash3('anystring', 123) . PHP_EOL; // specific seed usage
// Some locale strings
echo murmurhash3('№АаЯя') . PHP_EOL;
// Example from @maksimf
echo murmurhash3('豥붢㦖徱阵儹㜀耄巅簏罚撦') . PHP_EOL;
echo murmurhash3('豥붢㦖徱阵儹㜀耄巅簏罚撦', 1096928849) . PHP_EOL;
echo 'all ok' . PHP_EOL;