v0.0.3 - Runtime Hasher and C ABI Streaming
Third public release of zig-files-hash, focused on chunked/streaming hashing.
Highlights
- Added public runtime hasher API in Zig:
RuntimeHasher.init(alg, options)RuntimeHasher.update(chunk)RuntimeHasher.digestLength()RuntimeHasher.final(out)RuntimeHasher.finalResult()+digest.slice()helper flow
dispatchnow usesRuntimeHasheras the shared hashing path.- Kept public helper
digestLength(alg)for non-streaming consumers. - Added test coverage for
RuntimeHasher.digestLength.
C ABI v2
- ABI version bumped:
ZFH_API_VERSION = 2. - Streaming C ABI now uses caller-provided state buffer (inplace, no heap allocations).
- Added streaming C functions:
zfh_hasher_state_sizezfh_hasher_state_alignzfh_hasher_init_inplacezfh_hasher_updatezfh_hasher_final
zfh_digest_lengthnow resolves via Zig publicdigestLength(alg)to keep one
source of truth for digest sizes.- Added C ABI streaming tests (chunked success, key-required mapping,
buffer-too-small on final, invalid state checks). - Defined post-final behavior for streaming state:
repeatedzfh_hasher_finalandzfh_hasher_updateafter final return
ZFH_INVALID_ARGUMENT.
Compatibility notes
- Zig API remains allocation-free:
stringHash/fileHashunchanged for existing usage- streaming is additive via
RuntimeHasher
- C API consumers should regenerate bindings against
src/zig_files_hash_c_api.h(ZFH_API_VERSION = 2). - Minimum Zig version remains
0.15.2.