CryptoHash

Trait CryptoHash 

Source
pub trait CryptoHash {
    // Required methods
    fn available(self) -> bool;
    fn size(self) -> isize;
    fn string(self) -> &'static str;
    fn set(self, _: &str) -> Result<Self, Error>
       where Self: Sized;
    fn digester(&self) -> Box<dyn DynDigest>;
    fn hash(self) -> Box<dyn DynDigest>;
    fn encode(&self, _: &[u8]) -> String;
    fn from_reader<R: Read>(&self, _: R) -> String;
    fn from_bytes(&self, _: &[u8]) -> String;
    fn from_string(&self, _: &str) -> String;
    fn from_file(&self, _: &str) -> Result<String, Error>;
    fn validate(&self, _: &str) -> bool;
}
Expand description

CryptoHash is the interface that any hash algorithm must implement

Required Methods§

Source

fn available(self) -> bool

Source

fn size(self) -> isize

Source

fn string(self) -> &'static str

Source

fn set(self, _: &str) -> Result<Self, Error>
where Self: Sized,

Source

fn digester(&self) -> Box<dyn DynDigest>

Source

fn hash(self) -> Box<dyn DynDigest>

Source

fn encode(&self, _: &[u8]) -> String

Source

fn from_reader<R: Read>(&self, _: R) -> String

Source

fn from_bytes(&self, _: &[u8]) -> String

Source

fn from_string(&self, _: &str) -> String

Source

fn from_file(&self, _: &str) -> Result<String, Error>

Source

fn validate(&self, _: &str) -> bool

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§

Source§

impl CryptoHash for Algorithm<'static>