Trait HashAlgorithmTrait

Source
pub trait HashAlgorithmTrait:
    Send
    + Sync
    + 'static
    + Debug {
    // Required methods
    fn hash(&self, data: &[u8]) -> Vec<u8> ;
    fn hmac(&self, key: &[u8], msg: &[u8]) -> Result<Vec<u8>>;
    fn algorithm(&self) -> HashAlgorithm;
    fn clone_box(&self) -> Box<dyn HashAlgorithmTrait>;
    fn into_boxed(self) -> Box<dyn HashAlgorithmTrait>;
}

Required Methods§

Source

fn hash(&self, data: &[u8]) -> Vec<u8>

Hashes the given data.

哈希给定的数据。

Source

fn hmac(&self, key: &[u8], msg: &[u8]) -> Result<Vec<u8>>

Computes the HMAC of a message using the given key.

使用给定的密钥计算消息的 HMAC。

Source

fn algorithm(&self) -> HashAlgorithm

Returns the algorithm enum.

返回算法枚举。

Source

fn clone_box(&self) -> Box<dyn HashAlgorithmTrait>

Clones the algorithm.

克隆算法。

Source

fn into_boxed(self) -> Box<dyn HashAlgorithmTrait>

Trait Implementations§

Source§

impl Clone for Box<dyn HashAlgorithmTrait>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl From<Hash256Wrapper> for Box<dyn HashAlgorithmTrait>

Source§

fn from(wrapper: Hash256Wrapper) -> Self

Converts to this type from the input type.
Source§

impl From<Hash384Wrapper> for Box<dyn HashAlgorithmTrait>

Source§

fn from(wrapper: Hash384Wrapper) -> Self

Converts to this type from the input type.
Source§

impl From<Hash512Wrapper> for Box<dyn HashAlgorithmTrait>

Source§

fn from(wrapper: Hash512Wrapper) -> Self

Converts to this type from the input type.
Source§

impl HashAlgorithmTrait for Box<dyn HashAlgorithmTrait>

Source§

fn hash(&self, data: &[u8]) -> Vec<u8>

Hashes the given data. Read more
Source§

fn hmac(&self, key: &[u8], msg: &[u8]) -> Result<Vec<u8>>

Computes the HMAC of a message using the given key. Read more
Source§

fn algorithm(&self) -> HashAlgorithm

Returns the algorithm enum. Read more
Source§

fn clone_box(&self) -> Box<dyn HashAlgorithmTrait>

Clones the algorithm. Read more
Source§

fn into_boxed(self) -> Box<dyn HashAlgorithmTrait>

Implementations on Foreign Types§

Source§

impl HashAlgorithmTrait for Box<dyn HashAlgorithmTrait>

Source§

fn hash(&self, data: &[u8]) -> Vec<u8>

Source§

fn hmac(&self, key: &[u8], msg: &[u8]) -> Result<Vec<u8>>

Source§

fn algorithm(&self) -> HashAlgorithm

Source§

fn clone_box(&self) -> Box<dyn HashAlgorithmTrait>

Source§

fn into_boxed(self) -> Box<dyn HashAlgorithmTrait>

Implementors§