]> granicus.if.org Git - php/commit
hash: Add MurmurHash3 with streaming support
authorAnatol Belski <ab@php.net>
Sun, 30 Aug 2020 12:14:04 +0000 (14:14 +0200)
committerAnatol Belski <ab@php.net>
Sat, 31 Oct 2020 15:44:18 +0000 (16:44 +0100)
commit72e91e9fc82b85d0c5a6ff043cd1b2daee6c26d0
tree9c7c37fc43f6d94decaffe80151185322890d1b6
parent831abe2d905ad5e44f9eddaf7e6120866b6f9a06
hash: Add MurmurHash3 with streaming support

The implementation is based on the upstream PMurHash. The following
variants are implemented

- murmur3a, 32-bit hash
- murmur3c, 128-bit hash for x86
- murmur3f, 128-bit hash for x64

The custom seed support is not targeted by this implementation. It will
need a major change to the API, so then custom arguments can be passed
through `hash_init`. For now, the starting hash is always zero.

Fixes bug #68109, closes #6059

Signed-off-by: Anatol Belski <ab@php.net>
Co-Developed-by: Michael Wallner <mike@php.net>
Signed-off-by: Michael Wallner <mike@php.net>
17 files changed:
ext/hash/config.m4
ext/hash/config.w32
ext/hash/hash.c
ext/hash/hash_murmur.c [new file with mode: 0644]
ext/hash/murmur/PMurHash.c [new file with mode: 0644]
ext/hash/murmur/PMurHash.h [new file with mode: 0644]
ext/hash/murmur/PMurHash128.c [new file with mode: 0644]
ext/hash/murmur/PMurHash128.h [new file with mode: 0644]
ext/hash/murmur/endianness.h [new file with mode: 0644]
ext/hash/php_hash.h
ext/hash/php_hash_murmur.h [new file with mode: 0644]
ext/hash/tests/hash-clone.phpt
ext/hash/tests/hash_algos.phpt
ext/hash/tests/hash_copy_001.phpt
ext/hash/tests/hash_serialize_001.phpt
ext/hash/tests/hash_serialize_002.phpt
ext/hash/tests/murmurhash3.phpt [new file with mode: 0644]