https://github.com/thevilledev/chibihash-zig
ChibiHash in Zig - a small, fast 64-bit hash function
https://github.com/thevilledev/chibihash-zig
hash-functions zig zig-package
Last synced: 4 months ago
JSON representation
ChibiHash in Zig - a small, fast 64-bit hash function
- Host: GitHub
- URL: https://github.com/thevilledev/chibihash-zig
- Owner: thevilledev
- License: mit
- Created: 2024-11-27T21:33:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-02T21:12:20.000Z (over 1 year ago)
- Last Synced: 2025-03-16T16:59:12.857Z (about 1 year ago)
- Topics: hash-functions, zig, zig-package
- Language: Zig
- Homepage: https://chibiha.sh
- Size: 11.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ChibiHash64-Zig
A Zig port of [ChibiHash64](https://github.com/N-R-K/ChibiHash) - a small, fast 64-bit hash function. See the article [ChibiHash: A small, fast 64-bit hash function](https://nrk.neocities.org/articles/chibihash) for more information.
All credit for the algorithm goes to [N-R-K](https://github.com/N-R-K).
## Features
- Simple 64-bit hash function
- Supports both v1 and v2 of the hash function
- HashMap implementation
- Thoroughly tested with known test vectors
## Usage
```
const std = @import("std");
const ChibiHash64v1 = @import("chibihash64_v1.zig");
const ChibiHash64v2 = @import("chibihash64_v2.zig");
// Basic hashing v1
const hash = ChibiHash64v1.hash("Hello, world!", 0);
// Using HashMap v1
var map = ChibiHash64v1.HashMap([]const u8, i32).init(allocator);
defer map.deinit();
// Basic hashing v2
const hash = ChibiHash64v2.hash("Hello, world!", 0);
// Using HashMap v2
var map = ChibiHash64v2.HashMap([]const u8, i32).init(allocator);
defer map.deinit();
```
See `example/example.zig` for a complete example. Run it with `zig build run-example`.
## License
MIT.