[−][src]Trait merkle::Hashable
The type of values stored in a MerkleTree
must implement
this trait, in order for them to be able to be fed
to a Ring Context
when computing the hash of a leaf.
A default instance for types that already implements
AsRef<[u8]>
is provided.
Example
Here is an example of how to implement Hashable
for a type
that does not (or cannot) implement AsRef<[u8]>
:
ⓘThis example is not tested
impl Hashable for PublicKey { fn update_context(&self, context: &mut Context) { let bytes: Vec<u8> = self.to_bytes(); context.update(&bytes); } }
Required methods
fn update_context(&self, context: &mut Context)
Update the given context
with self
.
See ring::digest::Context::update
for more information.