Readme
simple-hash-c
FNV-1a 64-bit string hash. Native plugin example, written in C — one source file, one function, no third-party deps.
Install
bpm install simple-hash-cbpm picks the right binary for your platform.
Use
import "simple-hash-c" as h;
print(h.version); // 1.0.0
print(h.fnv1a("hello")); // a430d84680aabd0b (16-char hex)API
fnv1a(s)— FNV-1a 64-bit hash ofs, returned as a 16-char lowercase hex stringversion— package version string
Build (for the maintainer)
The plugin uses zig as the toolchain — one small download, no Visual Studio, no Developer Command Prompt, no per-platform host. One command from any OS builds binaries for every target in bnl.json.
# 1. Install zig once
winget install zig.zig # Windows
brew install zig # macOS
snap install zig --classic # Linux
# 2. Build all 6 targets from any host
.\build.ps1 # Windows
./build.sh # macOS / LinuxOutput:
build/darwin-arm64/simple-hash-c.dylib
build/darwin-x64/simple-hash-c.dylib
build/linux-x64/simple-hash-c.so
build/linux-x86/simple-hash-c.so
build/windows-x64/simple-hash-c.dll
build/windows-x86/simple-hash-c.dllThe plugin only needs bnl/plugin.h (vendored in src/bnl/) — no bnl runtime link.
Publish (for the maintainer)
bpm publishbpm reads the targets map in bnl.json, uploads one tarball per platform, and the registry resolves per-platform at install time.
MIT licensed.