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_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 crypto_common::rand_core;
rand_core
pub use zeroize;
zeroize
pub use block_buffer;
core-api
pub use const_oid;
oid
pub use crypto_common;
pub use crypto_common::array;
pub use crypto_common::typenum;
Modules§
- Type aliases for many constants.
- core_api
core-api
Low-level traits operating on blocks and wrappers around them. - dev
dev
Development-related functionality
Macros§
- bench_update
dev
DefineUpdate
impl benchmark - Define hash function serialization test
- Define hash function serialization test
- impl_oid_carrier
core-api
Implement dummy type with hidden docs which is used to “carry” hasher OID forCtVariableCoreWrapper
. - new_mac_test
dev
andmac
Define MAC test - new_resettable_mac_test
dev
andmac
Define resettable MAC test - new_test
dev
Define hash function test
Structs§
- CtOutput
mac
Fixed size output value which provides a safeEq
implementation that runs in constant time. - HashReader
std
Abstraction over a reader which hashes the data being read - HashWriter
std
Abstraction over a writer which hashes the data being written. - Buffer length is not equal to hash output size.
- The error type returned when key and/or IV used in the
KeyInit
,KeyIvInit
, andInnerIvInit
slice-based methods had an invalid length. - The error type used in variable hash traits.
- MacError
mac
Traits§
- Trait for hash functions with customization string for domain separation.
- Convenience wrapper trait covering functionality of cryptographic hash functions with fixed output size.
- Modification of the
Digest
trait suitable for trait objects. - DynDigestWithOid
const-oid
Convenience wrapper trait around DynDigest and DynAssociatedOid. - Trait for hash functions with extendable-output (XOF).
- Trait for hash functions with extendable-output (XOF) able to reset themselves.
- Trait for hash functions with fixed-size output.
- Trait for hash functions with fixed-size output able to reset themselves.
- Marker trait for cryptographic hash functions.
- InnerInit
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. - Types which return data with the given size.
- Resettable types.
- Types which consume data with byte granularity.
- Trait for hash functions with variable-size output.
- Trait for hash functions with variable-size output able to reset themselves.
- Trait for reader types which are used to extract extendable output from a XOF (extendable-output function) result.
Type Aliases§
- Key
mac
Key used byKeySizeUser
implementors. - Output array of
OutputSizeUser
implementors.