https://github.com/nikomalik/wyhash
wyhash implementation in zig
https://github.com/nikomalik/wyhash
wyhash zig zig-lib zig-package zig-wyhash ziglang
Last synced: 6 months ago
JSON representation
wyhash implementation in zig
- Host: GitHub
- URL: https://github.com/nikomalik/wyhash
- Owner: NikoMalik
- License: mit
- Created: 2025-01-29T22:04:23.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-03-10T21:25:10.000Z (7 months ago)
- Last Synced: 2025-04-13T07:13:58.961Z (6 months ago)
- Topics: wyhash, zig, zig-lib, zig-package, zig-wyhash, ziglang
- Language: Zig
- Homepage:
- Size: 7.81 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WYHASH - Zig Implementation
 
π Overview
Wyhash is a fast, high-quality, portable non-cryptographic hash function known for its exceptional speed and randomness quality.
This repository provides a native Zig implementation of Wyhash.Project is also open for people to add to and improve. Please check the issues to view requested featuresWhy Wyhash?
- β Extremely fast performance across different architectures
- β High-quality randomness and strong avalanche effect
- β Minimal code size and efficient memory usage
- β Used in databases, networking, and high-performance applications# π Basic Usage
```zig
const wyhash = @import("wyhash");
const std = @import("std");pub fn main() !void {
const r: u64 = 0x001020120;const res = wyhash._whash("π₯Hello World!", r);
std.debug.print("wyhash(\"π₯Hello World!\", {}) = {}\n", .{ r, res });
}```
# π¦ Installation
*Add this to your build.zig.zon*
```zig
.dependencies = .{
.wyhash = .{
.url = "https://github.com/NikoMalik/wyhash/archive/refs/heads/main.tar.gz",
//the correct hash will be suggested by zig
}
}```
*And add this to you build.zig*
```zig
const wyhash = b.dependency("wyhash", .{
.target = target,
.optimize = optimize,
});
exe_mod.addImport("wyhash", wyhash.module("wyhash"));```
You can then import the library into your code like this```zig
const wyhash = @import("wyhash")
```# π¦ Installation/2
```bash
git clone https://github.com/NikoMalik/wyhash.git
mv wyhash /path/to/your/project/directory
```# π₯ Benchmarks
Wyhash is one of the fastest hash functions available. Benchmarks against MurmurHash3, XXHash, and CityHash show superior performance in most cases.
# π₯ Credits
Original Wyhash: Wang Yi
Repo: https://github.com/wangyi-fudan/wyhash