Crate digest

Crate digest 

Source
Expand description

This crate provides traits which describe functionality of cryptographic hash functions and Message Authentication algorithms.

Traits in this repository are organized into the following levels:

  • High-level convenience traits: [Digest], [DynDigest], [Mac]. Wrappers around lower-level traits for most common use-cases. Users should usually prefer using these traits.
  • Mid-level traits: Update, FixedOutput, FixedOutputReset, ExtendableOutput, ExtendableOutputReset, XofReader, VariableOutput, Reset, KeyInit, and InnerInit. These traits atomically describe available functionality of an algorithm.
  • Marker traits: [HashMarker], [MacMarker]. Used to distinguish different algorithm classes.
  • Low-level traits defined in the core_api module. These traits operate at a block-level and do not contain any built-in buffering. They are intended to be implemented by low-level algorithm providers only. Usually they should not be used in application-level code.

Additionally hash functions implement traits from the standard library: Default, Clone, Write. The latter is feature-gated behind std feature, which is usually enabled by default by hash implementation crates.

Re-exports§

pub use crate::digest::Digest;
pub use crate::digest::DynDigest;
pub use crate::digest::HashMarker;
pub use mac::CtOutput;mac
pub use mac::Mac;mac
pub use mac::MacError;mac
pub use mac::MacMarker;mac
pub use block_buffer;core-api
pub use crypto_common;
pub use crypto_common::generic_array;
pub use crypto_common::typenum;

Modules§

consts
core_apicore-api
Low-level traits operating on blocks and wrappers around them.

Macros§

impl_oid_carrier
Implement dummy type with hidden docs which is used to “carry” hasher OID for [CtVariableCoreWrapper].

Structs§

InvalidBufferSize
Buffer length is not equal to hash output size.
InvalidLengthmac
The error type returned when key and/or IV used in the KeyInit, KeyIvInit, and InnerIvInit slice-based methods had an invalid length.
InvalidOutputSize
The error type used in variable hash traits.

Traits§

ExtendableOutput
Trait for hash functions with extendable-output (XOF).
ExtendableOutputReset
Trait for hash functions with extendable-output (XOF) able to reset themselves.
FixedOutput
Trait for hash functions with fixed-size output.
FixedOutputReset
Trait for hash functions with fixed-size output able to reset themselves.
InnerInitmac
Types which can be initialized from another type (usually block ciphers).
KeyInitmac
Types which can be initialized from key.
OutputSizeUser
Types which return data with the given size.
Reset
Resettable types.
Update
Types which consume data with byte granularity.
VariableOutput
Trait for hash functions with variable-size output.
VariableOutputReset
Trait for hash functions with variable-size output able to reset themselves.
XofReader
Trait for reader types which are used to extract extendable output from a XOF (extendable-output function) result.

Type Aliases§

Keymac
Key used by KeySizeUser implementors.
Output
Output array of OutputSizeUser implementors.