跳到主要内容

Hash

特性 Hash 

Source
pub trait Hash: Send + Sync {
    // Required methods
    fn start(&self) -> Box<dyn Context>;
    fn hash(&self, data: &[u8]) -> Output;
    fn output_len(&self) -> usize;
    fn algorithm(&self) -> HashAlgorithm;

    // Provided method
    fn fips(&self) -> bool { ... }
}
展开描述

Describes 一个 single cryptographic hash function.

This interface can do both one-shot 并 incremental hashing, using Hash::hash()Hash::start() respectively.

必需方法§

Source

fn start(&self) -> Box<dyn Context>

Start an incremental hash computation.

Source

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

Return 输出 of this hash function with input data

Source

fn output_len(&self) -> usize

此 length in bytes of this hash function’s output.

Source

fn algorithm(&self) -> HashAlgorithm

这是哪个哈希函数,例如 HashAlgorithm::SHA256

提供方法§

Source

fn fips(&self) -> bool

Return true if this is 由 FIPS 批准的实现支持。

实现者§