Trait ShaAlgorithm

Source
pub trait ShaAlgorithm: Sealed {
    const ALGORITHM: &'static str;
    const CHUNK_LENGTH: usize;
    const DIGEST_LENGTH: usize;
}
Available on crate feature unstable only.
Expand description

This trait encapsulates the configuration for a specific SHA algorithm.

Required Associated Constants§

Source

const ALGORITHM: &'static str

Constant containing the name of the algorithm as a string.

Source

const CHUNK_LENGTH: usize

The length of the chunk that the algorithm processes at a time.

For example, in SHA-256, this would typically be 64 bytes.

Source

const DIGEST_LENGTH: usize

The length of the resulting digest produced by the algorithm.

For example, in SHA-256, this would be 32 bytes.

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 ShaAlgorithm for Sha1

Source§

const ALGORITHM: &'static str = "Sha1"

Source§

const CHUNK_LENGTH: usize = 64usize

Source§

const DIGEST_LENGTH: usize = 20usize

Source§

impl ShaAlgorithm for Sha224

Source§

const ALGORITHM: &'static str = "Sha224"

Source§

const CHUNK_LENGTH: usize = 64usize

Source§

const DIGEST_LENGTH: usize = 28usize

Source§

impl ShaAlgorithm for Sha256

Source§

const ALGORITHM: &'static str = "Sha256"

Source§

const CHUNK_LENGTH: usize = 64usize

Source§

const DIGEST_LENGTH: usize = 32usize