Expand description
HashPlugin trait — the Rust-side counterpart of the hash v0 wire
protocol.
Plugin authors implement this trait on their hash state type, then
apply #[plugin_interface(name = "hash", version = 0)] to the impl
block. The macro emits the eight canonical cfmp_hash_* FFI symbols,
one per trait method.
Method → symbol mapping (see crates/confium-core/src/ffi/hash.rs
for the loader-side wire types):
| trait method | FFI symbol | purpose |
|---|---|---|
HashPlugin::create_with_opts | cfmp_hash_create | construct a new instance |
HashPlugin::output_size | cfmp_hash_output_size | output length in bytes |
HashPlugin::block_size | cfmp_hash_block_size | internal block size in bytes |
HashPlugin::update | cfmp_hash_update | absorb input bytes |
HashPlugin::reset | cfmp_hash_reset | reset to initial state |
HashPlugin::try_clone | cfmp_hash_clone | duplicate the state |
HashPlugin::finalize | cfmp_hash_finalize | emit digest into caller buffer |
Drop | cfmp_hash_destroy | reclaim the boxed state |
Traits§
- Hash
Plugin - Trait implemented by hash plugins. The macro-generated
cfmp_hash_createcallsHashPlugin::create_with_opts; all other symbols dispatch throughOpaqueHandle::<Self>::borrow_rawand the corresponding trait method.
Functions§
- create_
simple - Trivial constructor entry point for plugin authors who don’t need
opts. WrapsHashPlugin::create_with_optswithNone. - default_
block_ size - Default
block_sizeimplementation for hash plugins that don’t have a meaningful block size. Returns 64, the common block size for SHA-2 family hashes.