https://github.com/jwerle/murmurhash.c
MurmurHash3 general hash bashed lookup function implementation
https://github.com/jwerle/murmurhash.c
Last synced: about 1 year ago
JSON representation
MurmurHash3 general hash bashed lookup function implementation
- Host: GitHub
- URL: https://github.com/jwerle/murmurhash.c
- Owner: jwerle
- License: mit
- Created: 2014-05-05T12:56:49.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2024-12-31T18:49:03.000Z (over 1 year ago)
- Last Synced: 2025-03-30T03:03:45.563Z (about 1 year ago)
- Language: C
- Size: 22.5 KB
- Stars: 85
- Watchers: 1
- Forks: 30
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
murmurhash
==========

> MurmurHash3 general hash bashed lookup function implementation
## about
[MurmurHash](http://en.wikipedia.org/wiki/MurmurHash) is a non-cryptographic hash function suitable
for general hash-based lookup. This implementation implements version 3
of MurmurHash.
## install
[clib](https://github.com/clibs/clib):
```sh
$ clib install jwerle/murmurhash.c
```
source:
```sh
$ git clone git@github.com:jwerle/murmurhash.c.git
$ cd murmurhash.c
$ make
$ make install
```
## example
```c
#include
#include
#include
int
main (void) {
uint32_t seed = 0;
const char *key = "kinkajou";
uint32_t hash = murmurhash(key, (uint32_t) strlen(key), seed); // 0xb6d99cf8
return 0;
}
```
A command line executable is also available:
```sh
$ echo -n kinkajou | murmur
3067714808
```
```sh
$ echo -n panda | murmur --seed=10
1406483717
```
## api
```c
uint32_t
murmurhash (const char *key, uint32_t len, uint32_t seed);
```
Returns a murmur hash of `key` based on `seed` using the MurmurHash3 algorithm.
## license
MIT