Volver al ranking

wangyi-fudan/wyhash

C

The FASTEST QUALITY hash function, random number generators (PRNG) and hash map.

hashfastsimplerandom-number-generatorschashmapbloom-filter
Crecimiento de estrellas
Estrellas
1.1k
Forks
75
Crecimiento semanal
Issues
16
5001k
ene 2023mar 2024may 2025jul 2026
README

New PRNG: w1rand that passed BigCrush and PractRand(512GB)

static inline uint64_t w1rand(uint64_t *s) {
  const uint64_t c = 0xd07ebc63274654c7ull;
  *s += c;
  __uint128_t t = (__uint128_t)*s * (*s ^ c);
  return (t >> 64) ^ t;
}

wyhash has evolved into rapidhash !
With improved speed, quality and compatibility.

No hash function is perfect, but some are useful.

wyhash and wyrand are the ideal 64-bit hash function and PRNG respectively:

solid: wyhash passed SMHasher, wyrand passed BigCrush, practrand.

portable: 64-bit/32-bit system, big/little endian.

fastest: Efficient on 64-bit machines, especially for short keys.

simplest: In the sense of code size.

salted: We use dynamic secret to avoid intended attack.

wyhash is the default hashing algorithm of the great Zig, V, Nim and Go (since 1.17) language. One milestone is that wyhash has deployed by Microsoft on [Windows Terminal] (https://github.com/microsoft/terminal/pull/13686).

Simple Example:

#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);

Limitations:

It is known now that wyhash/wyrand have their limitations:

Both of them are not 64 bit collision resistant, but is about 62 bits (flyingmutant/Cyan4973/vigna)

When test on longer dataset (32TB, 23 days), wyrand will fail practrand (vigna)

And there may be more flaws detected in the future.

User should make their own decision based the advantage and the flaws of wyhash/wyrand as no one is perfect.


C# https://github.com/cocowalla/wyhash-dotnet

C++ https://github.com/tommyettinger/waterhash

C++ https://github.com/alainesp/wy

GO https://github.com/dgryski/go-wyhash

GO https://github.com/orisano/wyhash

GO https://github.com/littleli/go-wyhash16

GO https://github.com/zeebo/wyhash

GO https://github.com/lonewolf3739/wyhash-go

GO https://github.com/zhangyunhao116/wyhash (final version 1 && 3)

Java https://github.com/OpenHFT/Zero-Allocation-Hashing

Java https://github.com/dynatrace-oss/hash4j (final version 3 and 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


I thank these names:

Reini Urban

Dietrich Epp

Joshua Haberman

Tommy Ettinger

Daniel Lemire

Otmar Ertl

cocowalla

leo-yuriev

Diego Barrios Romero

paulie-g

dumblob

Yann Collet

ivte-ms

hyb

James Z.M. Gao

easyaspi314 (Devin)

TheOneric

flyingmutant

vigna

tansy

Repositorios relacionados
openwall/john

John the Ripper jumbo - advanced offline password cracker, which supports hundreds of hash and cipher types, and runs on many operating systems, CPUs, GPUs, and even some FPGAs

COtherjohnc
openwall.com/john/
13.4k2.5k
Cyan4973/xxHash

Extremely fast non-cryptographic hash algorithm

COtherxxhashsmhasher
xxhash.com
11.2k905
vinkla/hashids

A small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.

PHPPackagistMIT Licensephphashids
hashids.org/php
5.4k414
apple/swift-collections

Commonly used data structures for Swift

SwiftApache License 2.0collectioncontainer
4.5k397
niieani/hashids.js

A small JavaScript library to generate YouTube-like ids from numbers.

TypeScriptnpmMIT Licensehashidsjavascript
hashids.org/javascript
4.3k204
Neo23x0/Loki

Loki - Simple IOC and YARA Scanner

PythonPyPIGNU General Public License v3.0pythonyara
nextron-systems.com/compare-our-scanners/
3.8k615
ashvardanian/StringZilla

Up to 100x faster strings for C, C++, CUDA, Python, Rust, Swift, JS, & Go, leveraging NEON, AVX2, AVX-512, SVE, GPGPU, & SWAR to accelerate search, hashing, sorting, edit distances, sketches, and memory ops 🦖

CApache License 2.0simddataset
ashvardanian.com/posts/stringzilla/
3.5k131
namazso/OpenHashTab

📝 File hashing and checking shell extension

C++GNU General Public License v3.0hashhashtab
3.5k140
corkami/collisions

Hash collisions and exploitations

PythonPyPIcollisionshash
3.4k211
greg7mdp/parallel-hashmap

A family of header-only, very fast and memory-friendly hashmap and btree containers.

C++Apache License 2.0hashtables
greg7mdp.github.io/parallel-hashmap/
3.2k310
Neo23x0/signature-base

YARA signature and IOC database for my scanners and tools

YARAOthersignatureyara-rules
3k673
qlustered/deepdiff

DeepDiff: Deep Difference and search of any Python object/data. DeepHash: Hash of any object based on its contents. Delta: Use deltas to reconstruct objects by adding deltas together.

PythonPyPIOtherpythontree
zepworks.com/deepdiff
2.5k274