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 core_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, Clone, Write. The latter is
feature-gated behind std feature, which is usually enabled by default
by hash implementation crates.
Re-exports§
- pub use crypto_common::rand_core;- rand_core
- pub use block_buffer;- core-api
- pub use const_oid;- oid
- pub use crypto_common;
- pub use crypto_common::generic_array;
- pub use crypto_common::typenum;
Modules§
- consts
- core_api core-api
- Low-level traits operating on blocks and wrappers around them.
- devdev
- Development-related functionality
Macros§
- bench_update dev
- Define Updateimpl benchmark
- impl_oid_ carrier core-api
- Implement dummy type with hidden docs which is used to “carry” hasher
OID for CtVariableCoreWrapper.
- 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
- Fixed size output value which provides a safe Eqimplementation that runs in constant time.
- InvalidBuffer Size 
- Buffer length is not equal to hash output size.
- InvalidLength 
- The error type returned when key and/or IV used in the KeyInit,KeyIvInit, andInnerIvInitslice-based methods had an invalid length.
- InvalidOutput Size 
- The error type used in variable hash traits.
- MacError
- Error type for when the Outputof aMacis not equal to the expected value.
Traits§
- Digest
- Convenience wrapper trait covering functionality of cryptographic hash functions with fixed output size.
- DynDigest
- Modification of the Digesttrait suitable for trait objects.
- ExtendableOutput 
- Trait for hash functions with extendable-output (XOF).
- ExtendableOutput Reset 
- Trait for hash functions with extendable-output (XOF) able to reset themselves.
- FixedOutput 
- Trait for hash functions with fixed-size output.
- FixedOutput Reset 
- Trait for hash functions with fixed-size output able to reset themselves.
- HashMarker 
- Marker trait for cryptographic hash functions.
- InnerInit 
- Types which can be initialized from another type (usually block ciphers).
- KeyInit
- Types which can be initialized from key.
- Mac
- Convenience wrapper trait covering functionality of Message Authentication algorithms.
- MacMarker
- Marker trait for Message Authentication algorithms.
- OutputSize User 
- 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.
- VariableOutput 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
- Key used by KeySizeUserimplementors.
- Output
- Output array of OutputSizeUserimplementors.