Skip to content

Commit de40281

Browse files
committed
Rename *result* to finalize
Implements the API changes from: RustCrypto/traits#161 The `crypto-mac` crate now uses `update` and `finalize` nomenclature ala the Initialize-Update-Finalize (IUF) interface naming scheme.
1 parent 6fe20b2 commit de40281

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmac/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//!
1717
//! // `result` has type `Output` which is a thin wrapper around array of
1818
//! // bytes for providing constant time equality check
19-
//! let result = mac.result();
19+
//! let result = mac.finalize();
2020
//! // To get underlying array use the `into_bytes` method, but be careful,
2121
//! // since incorrect use of the tag value may permit timing attacks which
2222
//! // defeat the security provided by the `Output` wrapper
@@ -32,7 +32,7 @@
3232
//!
3333
//! mac.update(b"input message");
3434
//!
35-
//! # let tag_bytes = mac.clone().result().into_bytes();
35+
//! # let tag_bytes = mac.clone().finalize().into_bytes();
3636
//! // `verify` will return `Ok(())` if tag is correct, `Err(MacError)` otherwise
3737
//! mac.verify(&tag_bytes).unwrap();
3838
//! ```
@@ -156,7 +156,7 @@ where
156156
}
157157

158158
#[inline]
159-
fn result(self) -> Output<Self> {
159+
fn finalize(self) -> Output<Self> {
160160
let n = C::BlockSize::to_usize();
161161
let mut buf = self.buffer.clone();
162162
if self.pos == n {

daa/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl Mac for Daa {
9999
}
100100

101101
#[inline]
102-
fn result(mut self) -> Output<Self> {
102+
fn finalize(mut self) -> Output<Self> {
103103
if self.pos != 0 {
104104
self.cipher.encrypt_block(&mut self.buffer);
105105
}

hmac/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//!
2424
//! // `result` has type `Output` which is a thin wrapper around array of
2525
//! // bytes for providing constant time equality check
26-
//! let result = mac.result();
26+
//! let result = mac.finalize();
2727
//! // To get underlying array use `code` method, but be careful, since
2828
//! // incorrect use of the code value may permit timing attacks which defeat
2929
//! // the security provided by the `Output`
@@ -41,7 +41,7 @@
4141
//!
4242
//! mac.update(b"input message");
4343
//!
44-
//! # let code_bytes = mac.clone().result().into_bytes();
44+
//! # let code_bytes = mac.clone().finalize().into_bytes();
4545
//! // `verify` will return `Ok(())` if code is correct, `Err(MacError)` otherwise
4646
//! mac.verify(&code_bytes).unwrap();
4747
//! ```
@@ -144,7 +144,7 @@ where
144144
} else {
145145
let mut digest = D::default();
146146
digest.update(key);
147-
let output = digest.fixed_result();
147+
let output = digest.finalize_fixed();
148148
// `n` is calculated at compile time and will equal
149149
// D::OutputSize. This is used to ensure panic-free code
150150
let n = min(output.len(), hmac.i_key_pad.len());
@@ -175,11 +175,11 @@ where
175175
}
176176

177177
#[inline]
178-
fn result(self) -> Output<Self> {
178+
fn finalize(self) -> Output<Self> {
179179
let mut opad_digest = self.opad_digest.clone();
180-
let hash = self.digest.fixed_result();
180+
let hash = self.digest.finalize_fixed();
181181
opad_digest.update(&hash);
182-
Output::new(opad_digest.fixed_result())
182+
Output::new(opad_digest.finalize_fixed())
183183
}
184184

185185
#[inline]

pmac/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//!
1717
//! // `result` has type `Output` which is a thin wrapper around array of
1818
//! // bytes for providing constant time equality check
19-
//! let result = mac.result();
19+
//! let result = mac.finalize();
2020
//! // To get underlying array use `into_bytes` method, but be careful, since
2121
//! // incorrect use of the tag value may permit timing attacks which defeat
2222
//! // the security provided by the `Output` wrapper
@@ -32,7 +32,7 @@
3232
//!
3333
//! mac.update(b"input message");
3434
//!
35-
//! # let tag_bytes = mac.clone().result().into_bytes();
35+
//! # let tag_bytes = mac.clone().finalize().into_bytes();
3636
//! // `verify` will return `Ok(())` if tag is correct, `Err(MacError)` otherwise
3737
//! mac.verify(&tag_bytes).unwrap();
3838
//! ```
@@ -229,7 +229,7 @@ where
229229
}
230230
}
231231

232-
fn result(self) -> Output<Self> {
232+
fn finalize(self) -> Output<Self> {
233233
let mut tag = self.tag.clone();
234234
// Special case for empty input
235235
if self.pos == 0 {

0 commit comments

Comments
 (0)