Multihash

Trait Multihash 

Source
pub trait Multihash: Default + PartialEq {
    type Digester: Default;

    // Required methods
    fn length(&self) -> u8;
    fn code(&self) -> Uvar;
    fn name(&self) -> &str;
    fn digest_primitive(&self, tag: Tag, bytes: &[u8]) -> Harvest;
    fn digest_collection(&self, tag: Tag, list: Vec<Vec<u8>>) -> Harvest;

    // Provided method
    fn digester(&self) -> Self::Digester { ... }
}
Expand description

Multihash trait to be implemented by any algorithm used by Blot.

For example, the SHA3-512 algorithm:

use blot::multihash::{Sha3512, Multihash};
use blot::uvar::Uvar;

let tag = Sha3512::default();

assert_eq!(tag.name(), "sha3-512");
assert_eq!(tag.code(), Uvar::new(vec![0x14]));
assert_eq!(tag.length(), 64);

Required Associated Types§

Required Methods§

Source

fn length(&self) -> u8

Source

fn code(&self) -> Uvar

Source

fn name(&self) -> &str

Source

fn digest_primitive(&self, tag: Tag, bytes: &[u8]) -> Harvest

Source

fn digest_collection(&self, tag: Tag, list: Vec<Vec<u8>>) -> Harvest

Provided Methods§

Source

fn digester(&self) -> Self::Digester

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§