[][src]Crate digest

This crate provides traits which describe functionality of cryptographic hash functions.

Traits in this repository are organized into high-level convenience traits, mid-level traits which expose more fine-grained functionality, and low-level traits intended to only be used by algorithm implementations:

  • High-level convenience traits: Digest, DynDigest. They are wrappers around lower-level traits for most common hash-function use-cases.
  • Mid-level traits: Update, FixedOutput, ExtendableOutput, Reset. These traits atomically describe available functionality of hash function implementations.
  • Low-level traits: UpdateCore, FixedOutputCore, ExtendableOutputCore, AlgorithmName. 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 and simplify the amount of work implementers need to do and therefore usually shouldn't 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.

The Digest trait is the most commonly used trait.

Re-exports

pub use block_buffer;
pub use generic_array;

Modules

consts

Type aliases for many constants.

devdev

Development-related functionality

Macros

benchdev

Define benchmark

new_testdev

Define test

Structs

GenericArray

Struct representing a generic array - GenericArray<T, N> works like [T; N]

InvalidBufferLengthalloc

Buffer length is not equal to the hash output size.

UpdateCoreWrapper

Wrapper around UpdateCore implementations.

XofReaderCoreWrapper

Wrapper around [XofReaderCore] implementations.

Traits

AlgorithmName

Trait which stores algorithm name constant, used in Debug implementations.

ArrayLength

Trait making GenericArray work, marking types to be used as length of an array

Digest

The Digest trait specifies an interface common for digest functions.

DynDigestalloc

The DynDigest trait is a modification of Digest trait suitable for trait objects.

ExtendableOutput

Trait which describes extendable-output functions (XOF).

ExtendableOutputCore

Trait for extendable-output function (XOF) core implementations to use to retrieve the hash output.

FixedOutput

Trait for returning digest result with the fixed size

FixedOutputCore

Trait for fixed-output digest implementations to use to retrieve the hash output.

Reset

Trait for resetting hasher instances

Update

Trait for updating hasher state with input data.

UpdateCore

Trait for updating hasher state with input data divided into blocks.

XofReader

Trait for describing readers which are used to extract extendable output from XOF (extendable-output function) result.

Type Definitions

Output

Fixed of fixed-sized hash-function used by Digest methods.