File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## 0.2.2 (UNRELEASED)
9+ ### Added
10+ - ` SetIvState ` trait ([ #2420 ] )
11+
12+ [ #2420 ] : https://github.com/RustCrypto/traits/pull/2420
13+
814## 0.2.1 (2026-02-25)
915### Changed
1016- ` BlockSizeUser::BlockSize ` is no longer bounded by ` BlockSizes ` ([ #2309 ] )
Original file line number Diff line number Diff line change @@ -310,6 +310,22 @@ pub trait IvState: IvSizeUser {
310310 fn iv_state ( & self ) -> Iv < Self > ;
311311}
312312
313+ /// Trait for setting current IV state.
314+ // TODO: merge with `IvState` in the next breaking release
315+ pub trait SetIvState : IvState {
316+ /// Set IV.
317+ fn set_iv ( & mut self , iv : & Iv < Self > ) ;
318+
319+ /// Execute the `f` closure with the current state and reset it back
320+ /// to the original state before the method returns.
321+ fn peek < T > ( & mut self , f : impl FnOnce ( & mut Self ) -> T ) -> T {
322+ let iv = self . iv_state ( ) ;
323+ let res = f ( self ) ;
324+ self . set_iv ( & iv) ;
325+ res
326+ }
327+ }
328+
313329impl < T > KeySizeUser for T
314330where
315331 T : InnerUser ,
You can’t perform that action at this time.
0 commit comments