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, andInnerInit. 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
block_apimodule. 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 and Clone.
This crate does not provide any implementations of the io::Read/Write traits,
see the digest-io crate for std::io-compatibility wrappers.
Re-exports§
pub use block_api as core_api;block-apipub use crypto_common::rand_core;rand_corepub use zeroize;zeroizepub use block_buffer;block-apipub use const_oid;oidpub use crypto_common;pub use crypto_common::array;pub use crypto_common::typenum;
Modules§
- block_
api block-api - Low-level traits operating on blocks and wrappers around them.
- consts
- dev
dev - Development-related functionality
Macros§
- bench_
update dev - Define
Updateimpl benchmark - buffer_
ct_ variable - Creates a buffered wrapper around block-level “core” type which implements variable output size traits with output size selected at compile time.
- buffer_
fixed - Creates a buffered wrapper around block-level “core” type which implements fixed output size traits.
- buffer_
rt_ variable - Creates a buffered wrapper around block-level “core” type which implements variable output size traits with output size selected at run time.
- buffer_
xof - Creates a buffered wrapper around block-level “core” type which implements extendable output size traits.
- hash_
rt_ outsize_ serialization_ test dev - Define hash function serialization test
- hash_
serialization_ test dev - Define hash function serialization test
- new_
mac_ test devandmac - Define MAC test
- new_
resettable_ mac_ test devandmac - Define resettable MAC test
- new_
test dev - Define hash function test
Structs§
- CtOutput
mac - Fixed size output value which provides a safe
Eqimplementation that runs in constant time. - Invalid
Buffer Size - Buffer length is not equal to hash output size.
- Invalid
Length mac - The error type returned when key and/or IV used in the
KeyInit,KeyIvInit, andInnerIvInitslice-based methods had an invalid length. - Invalid
Output Size - The error type used in variable hash traits.
- MacError
mac - Error type for when the
Outputof aMacis not equal to the expected value. - XofFixed
Wrapper - Wrapper around
ExtendableOutputtypes addingOutputSizeUserwith the given size ofS.
Traits§
- Collision
Resistance - Types with a certain collision resistance.
- Customized
Init - Trait for hash functions with customization string for domain separation.
- Digest
- Convenience wrapper trait covering functionality of cryptographic hash functions with fixed output size.
- DynDigest
- Modification of the
Digesttrait suitable for trait objects. - DynDigest
With Oid const-oid - Convenience wrapper trait around DynDigest and DynAssociatedOid.
- Extendable
Output - Trait for hash functions with extendable-output (XOF).
- Extendable
Output Reset - Trait for hash functions with extendable-output (XOF) able to reset themselves.
- Fixed
Output - Trait for hash functions with fixed-size output.
- Fixed
Output Reset - Trait for hash functions with fixed-size output able to reset themselves.
- Hash
Marker - Marker trait for cryptographic hash functions.
- Inner
Init mac - Types which can be initialized from another type (usually block ciphers).
- KeyInit
mac - Types which can be initialized from key.
- Mac
mac - Convenience wrapper trait covering functionality of Message Authentication algorithms.
- MacMarker
mac - Marker trait for Message Authentication algorithms.
- Output
Size User - Types which return data with the given size.
- Reset
- Resettable types.
- Update
- Types which consume data with byte granularity.
- VarOutput
Customized - Trait adding customization string to hash functions with variable output.
- Variable
Output - Trait for hash functions with variable-size output.
- Variable
Output Reset - 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§
- Key
mac - Key used by
KeySizeUserimplementors. - Output
- Output array of
OutputSizeUserimplementors.