Wyhash e Wyrand são a função ideal de hash de 64 bits e PRNG, respectivamente:
Solid : Wyhash passou por Smhasher, Wyrand passou por Bigcrush, Practrand.
Portátil : sistema de 64 bits/32 bits, Big/Little Endian.
O mais rápido : eficiente em máquinas de 64 bits, especialmente para chaves curtas.
Mais simples : no sentido do tamanho do código.
Saltado : usamos segredo dinâmico para evitar ataques pretendidos.
Wyhash é o algoritmo de hash padrão da linguagem Great Zig, V, Nim e Go (desde 1.17). Um marco é que o Wyhash foi implantado pela Microsoft no [Windows Terminal] (Microsoft/Terminal#13686).
Exemplo simples:
#include "wyhash.h"
uint64_t _wyp[4];
make_secret(time(NULL),_wyp);
string s="fcdskhfjs";
uint64_t h=wyhash(s.c_str(),s.size(),0,_wyp);
Limitações:
Sabe -se agora que Wyhash/Wyrand tem suas limitações:
Ambos não são resistentes à colisão de 64 bits, mas são cerca de 62 bits (FlyingMutant/Cyan4973/Vigna)
Quando teste em conjunto de dados mais longo (32 TB, 23 dias), Wyrand falhará em Practrand (Vigna)
E pode haver mais falhas detectadas no futuro.
O usuário deve tomar sua própria decisão com base na vantagem e nas falhas de Wyhash/Wyrand, pois ninguém é perfeito.
C# https://github.com/cocowalla/wyhash-dotnet
C ++ https://github.com/tommyettinger/waterhash
C ++ https://github.com/alaainsesp/wy
Vá https://github.com/dgryski/go-wyhash
Vá https://github.com/orisano/wyhash
Vá https://github.com/littleli/go-wyhash16
Vá https://github.com/zeebo/wyhash
Vá https://github.com/lonewolf3739/wyhash-go
Vá https://github.com/zhangyunhao1116/wyhash (versão final 1 && 3)
Java https://github.com/openhft/zero-allocation-hinging
Java https://github.com/dynatrace-oss/hash4j (versão final 3 e 4)
Kotlin multiplatform https://github.com/appmattus/crypto/tree/main/cryptohash
Nim https://github.com/nim-lang/nim/blob/devel/lib/pure/hashes.nim
Nim https://github.com/jackhftang/wyhash.nim
Nim https://github.com/littleli/nim-wyhash16
Rust https://github.com/eldruin/wyhash-rs
Swift https://github.com/lemire/swiftwyhash
Swift https://github.com/lemire/swiftwyhashbenchmark
Swift https://github.com/jeudesprits/pswyhash
V https://github.com/vlang/v/tree/master/vlib/hash/wyhash (v4)
Zig https://github.com/mandejan/zig-wyhash
Absl hashmap https://github.com/abseil/abseil-cpp/blob/master/absl/hash/internal/low_level_hash.h
Agradeço a esses nomes:
Reini urbano
Dietrich Epp
Joshua Haberman
Tommy Ettinger
Daniel Lemire
Otmar Ertl
Cocowalla
Leo-yuriev
Diego Barrios Romero
Paulie-G
DUBLOB
Yann Collet
IVTE-MS
hyb
James ZM Gao
EasyASPI314 (Devin)
Teonérico
FlyingMutant
Vigna
Tansy