Skip to main content

Crate flowscripter_io_cli_hash_native

Crate flowscripter_io_cli_hash_native 

Source
Expand description

§flowscripter-io-cli-hash-native

Rust-backed sha256 hasher exposed via Bun FFI, for demonstrating a zero-copy ChunkRef handoff outside of pluggable-io-framework itself. init/update/final mirrors OpenSSL’s EVP_Digest* shape: update is called once per chunk with a raw pointer into JS- or Rust-owned memory, final copies out the (small, 32-byte) digest and frees the context.

Structs§

HasherContext
Opaque hashing context. Only ever accessed through the hasher_* functions below - never dereferenced directly by callers.

Constants§

DIGEST_LENGTH

Functions§

hasher_final⚠
Finalizes the hash, copies the DIGEST_LENGTH-byte digest into the caller-supplied out buffer, and frees ctx - ctx must not be used again after this call.
hasher_init
Allocates a new hashing context. Must be freed by a matching call to hasher_final.
hasher_update⚠
Feeds len bytes starting at data into the hash. data may point into memory owned by either the JS heap (via bun:ffi’s ptr()) or Rust-owned memory (e.g. a future Rust-backed source’s NativeChunk) - this function reads it in place either way, without copying.