Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions digest/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.11.3 (UNRELEASED)
### Added
- `dev::initialized_mac_test` function ([#2367])

[#2367]: https://github.com/RustCrypto/traits/pull/2367

## 0.11.2 (2026-03-13)
### Changed
- Do not implement `Clone` as part of `(Reset)MacTraits` in the `buffer_fixed!` macro ([#2341])
Expand Down
11 changes: 11 additions & 0 deletions digest/src/dev/mac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ pub fn mac_test<M: Mac + KeyInit + Clone>(
return Err("Failed to initialize MAC instance");
};

initialized_mac_test(mac0, input, tag, trunc_side)
}

/// Run the MAC test directly on an initialized MAC.
/// This is useful for when custom initialization is needed
pub fn initialized_mac_test<M: Mac + Clone>(
mac0: M,
input: &[u8],
tag: &[u8],
trunc_side: MacTruncSide,
) -> Result<(), &'static str> {
let mut mac = mac0.clone();
mac.update(input);
let result = mac.finalize().into_bytes();
Expand Down