2.5 KiB
2.5 KiB
Hash logic
Keys are hashed.
Memcached hashes
Memcached itself uses either:
Golang
Beyond the Go ports of these hashes, Go includes native alternatives:
- Jenkins hash
- https://github.com/mtchavez/jenkins MIT license.
- https://github.com/tsaost/bjh port of lookup3.c. BSD license.
- https://github.com/Apsalar/lookup3 hashlittle() from lookup3.c. Optimized for compatibility/portability,
not for performance. Implements
hash.Hash32. Public domain. - https://github.com/MstrVLT/lookup3/ port of lookup3.c. License undefined.
- Murmur 3:
- https://github.com/reusee/mmh3 MIT license.
- https://github.com/huichen/murmur APL 2.0 license.
- https://github.com/go-ego/murmur APL 2.0 license. Based on huichen's version.
- https://github.com/beevik/murmur License undefined.
- https://github.com/ericx10ng/murmurhash2-go License undefined: was MIT but got removed.
- xxhash:
- https://github.com/vova616/xxhash/blob/master/xxhash.go (not ARM-compatible). MIT license.
- Golang standard library hashes:
- hash/adler32
- hash/crc32
- https://golang.org/pkg/hash/crc32/
- The Castagnoli polynomial may be hardware-accelerated on post-Nehalem CPUs compiled with 6g (https://stackoverflow.com/questions/23436358/bob-jenkins-hash-getting-bad-performance)
- hash/crc64:
- hash/fnv:
- Golang crypto package includes many
cryptographic hashed with optimized implementations too. Most interesting are probably MD5 and SHA1
- AES (Rijndael),
- Cipher package provides bloc cipher modes around low-level ciphers, no specific hashes.
- DES (DIPS 46-3)
- DSA (FIPS 186-3)
- ECDSA (FIPS 186-3)
- Elliptic package doesn't directly apply
- HMAC
- MD5 (RFC 1321)
- rand package doesn't directly apply
- RC4, RSA provide encryption, don't directly apply
- SHA1 (RFC 3174). Reported to be as fast as a Jenkins hash, but may not has optimal distribution properties
- SHA-256, SHA-384, SHA512, SHA512-224, SHA-512/256 (FIPC 180-4)
- subtle package doesn't directly apply
- TLS 1.2, doesn't directly apply
- X.509, doesn't directly apply