This repository has been archived on 2018-06-04. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
Go to file
Ray Slakinski 1031343f96 Allows extension to be compiled with php 5.4 2014-09-02 14:49:18 -04:00
install updated install instructions 2011-03-04 16:31:31 +01:00
06_murmurhash3.ini initial commit (alpha) 2011-03-01 14:11:17 +01:00
AUTHORS initial commit (alpha) 2011-03-01 14:11:17 +01:00
CHANGELOG Update to revision 136 of MurmurHash3 (marked as final) 2011-07-25 13:22:25 +02:00
GPL-LICENSE initial commit (alpha) 2011-03-01 14:11:17 +01:00
MIT-LICENSE initial commit (alpha) 2011-03-01 14:11:17 +01:00
MurmurHash3.cpp Update to revision 151 of MurmurHash3 2014-01-14 17:13:25 -05:00
MurmurHash3.h Update to revision 151 of MurmurHash3 2014-01-14 17:13:25 -05:00
README.md README.md 2014-01-14 17:45:30 -05:00
config.m4 initial commit (alpha) 2011-03-01 14:11:17 +01:00
php_murmurhash3.cpp Allows extension to be compiled with php 5.4 2014-09-02 14:49:18 -04:00
php_murmurhash3.h Created new 128 bit and 32 bit hasing functions in php. Aliased original function to the new 128 bit function. 2014-01-14 17:14:36 -05:00

README.md

MurmurHash3PHP

A C++ fork/rewrite of the smhasher project to bring Murmurhash3 to the Linux shell and to the PHP scripting language.

Installation

git clone https://github.com/sgtsquiggs/MurmurHash3PHP.git
cd MurmurHash3PHP
phpize
./configure --enable-murmurhash3
make install

Usage

MurmurHash is not cryptographically secure, so I am just using rand()

int seed = rand();
// 681830476 for this example

murmurhash3_128(key, seed)

Generates a 128 bit hash.

echo murmurhash3_128('this is the key for my 128 bit hash', seed);
// 476d1835de8c85f3f6686e7f68ac515a

murmurhash3_32(key, seed)

Generates a 32 bit hash.

echo murmurhash3_32('this is the key for my 32 bit hash', seed);
// 9853e119

murmurhash3(key, seed)

Alias of murmurhash3_128.