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§
Sourcefn hmac(&self, key: &[u8], msg: &[u8]) -> Result<Vec<u8>>
fn hmac(&self, key: &[u8], msg: &[u8]) -> Result<Vec<u8>>
Computes the HMAC of a message using the given key.
使用给定的密钥计算消息的 HMAC。
Sourcefn algorithm(&self) -> HashAlgorithm
fn algorithm(&self) -> HashAlgorithm
Returns the algorithm enum.
返回算法枚举。
Sourcefn clone_box(&self) -> Box<dyn HashAlgorithmTrait>
fn clone_box(&self) -> Box<dyn HashAlgorithmTrait>
Clones the algorithm.
克隆算法。
fn into_boxed(self) -> Box<dyn HashAlgorithmTrait>
Trait Implementations§
Source§impl Clone for Box<dyn HashAlgorithmTrait>
impl Clone for Box<dyn HashAlgorithmTrait>
Source§impl From<Hash256Wrapper> for Box<dyn HashAlgorithmTrait>
impl From<Hash256Wrapper> for Box<dyn HashAlgorithmTrait>
Source§fn from(wrapper: Hash256Wrapper) -> Self
fn from(wrapper: Hash256Wrapper) -> Self
Converts to this type from the input type.
Source§impl From<Hash384Wrapper> for Box<dyn HashAlgorithmTrait>
impl From<Hash384Wrapper> for Box<dyn HashAlgorithmTrait>
Source§fn from(wrapper: Hash384Wrapper) -> Self
fn from(wrapper: Hash384Wrapper) -> Self
Converts to this type from the input type.
Source§impl From<Hash512Wrapper> for Box<dyn HashAlgorithmTrait>
impl From<Hash512Wrapper> for Box<dyn HashAlgorithmTrait>
Source§fn from(wrapper: Hash512Wrapper) -> Self
fn from(wrapper: Hash512Wrapper) -> Self
Converts to this type from the input type.