Skip to content

Instantly share code, notes, and snippets.

View notsatvrn's full-sized avatar

satvrn notsatvrn

View GitHub Profile
@notsatvrn
notsatvrn / microhash.zig
Last active June 12, 2025 04:36
microhash: a hash function optimized for small strings
const std = @import("std");
const seed: u64 = 0x3243F6A8885A308D; // digits of pi
// folded multiply with a faster 32-bit path
// borrowed from foldhash and modified a bit
inline fn mix(x: u64, y: u64) u64 {
const builtin = @import("builtin");
const target = builtin.target;
const cpu = builtin.cpu;