File: Readme.md

package info (click to toggle)
libmurmurhash 1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 204 kB
  • sloc: ansic: 935; makefile: 46; sh: 9
file content (39 lines) | stat: -rw-r--r-- 1,748 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# LibMurmurHash

MurmurHash is one of the most commonly used non-cryptographic hash functions. This project bundles it into a shared library to avoid code duplication. Further it provides compatibility even for big-endian systems.

## Compiling and Installing

libmurmurhash has no prerequisites other than a reasonably up-to-date UNIX system.

    make
    make check
    make DESTDIR=/usr/local install

## API

LibMurmurHash provides the three variants of MurmurHash3 from the [original source](https://github.com/aappleby/smhasher). The first parameter specifies the beginning of the data to be hashed in memory. The second parameter gives the number of bytes to be hashed. The third parameter can be used to compute an alternative hash on the same data. Pass the location of the hash via the output parameter.

```C
#include <murmurhash.h>

void lmmh_x86_32(const void *addr, unsigned int len, uint32_t seed, uint32_t out[1]);
void lmmh_x86_128(const void *addr, unsigned int len, uint32_t seed, uint32_t out[4]);
void lmmh_x64_128(const void *addr, unsigned int len, uint32_t seed, uint64_t out[2]);
```

For compatibility the original API is still supported but *deprecated*. It has two problems; The given length could be negative; The out parameter has some peculiar alignment requirements.

```C
void MurmurHash3_x86_32(const void *data, int len, uint32_t seed, void *out);
void MurmurHash3_x86_128(const void *data, int len, uint32_t seed, void *out);
void MurmurHash3_x64_128(const void *data, int len, uint32_t seed, void *out);
```

## License

No license—all code is public domain. I appreciate credit, though.

## Contact

Please file a bug on GitHub <github.com/kloetzl/libmurmurhash> or send me a mail <kloetzl@evolbio.mpg.de>.