Skip to content

Rename *result* to finalize #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2020
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
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions cmac/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//!
//! // `result` has type `Output` which is a thin wrapper around array of
//! // bytes for providing constant time equality check
//! let result = mac.result();
//! let result = mac.finalize();
//! // To get underlying array use the `into_bytes` method, but be careful,
//! // since incorrect use of the tag value may permit timing attacks which
//! // defeat the security provided by the `Output` wrapper
Expand All @@ -32,7 +32,7 @@
//!
//! mac.update(b"input message");
//!
//! # let tag_bytes = mac.clone().result().into_bytes();
//! # let tag_bytes = mac.clone().finalize().into_bytes();
//! // `verify` will return `Ok(())` if tag is correct, `Err(MacError)` otherwise
//! mac.verify(&tag_bytes).unwrap();
//! ```
Expand Down Expand Up @@ -156,7 +156,7 @@ where
}

#[inline]
fn result(self) -> Output<Self> {
fn finalize(self) -> Output<Self> {
let n = C::BlockSize::to_usize();
let mut buf = self.buffer.clone();
if self.pos == n {
Expand Down
2 changes: 1 addition & 1 deletion daa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl Mac for Daa {
}

#[inline]
fn result(mut self) -> Output<Self> {
fn finalize(mut self) -> Output<Self> {
if self.pos != 0 {
self.cipher.encrypt_block(&mut self.buffer);
}
Expand Down
12 changes: 6 additions & 6 deletions hmac/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//!
//! // `result` has type `Output` which is a thin wrapper around array of
//! // bytes for providing constant time equality check
//! let result = mac.result();
//! let result = mac.finalize();
//! // To get underlying array use `code` method, but be careful, since
//! // incorrect use of the code value may permit timing attacks which defeat
//! // the security provided by the `Output`
Expand All @@ -41,7 +41,7 @@
//!
//! mac.update(b"input message");
//!
//! # let code_bytes = mac.clone().result().into_bytes();
//! # let code_bytes = mac.clone().finalize().into_bytes();
//! // `verify` will return `Ok(())` if code is correct, `Err(MacError)` otherwise
//! mac.verify(&code_bytes).unwrap();
//! ```
Expand Down Expand Up @@ -144,7 +144,7 @@ where
} else {
let mut digest = D::default();
digest.update(key);
let output = digest.fixed_result();
let output = digest.finalize_fixed();
// `n` is calculated at compile time and will equal
// D::OutputSize. This is used to ensure panic-free code
let n = min(output.len(), hmac.i_key_pad.len());
Expand Down Expand Up @@ -175,11 +175,11 @@ where
}

#[inline]
fn result(self) -> Output<Self> {
fn finalize(self) -> Output<Self> {
let mut opad_digest = self.opad_digest.clone();
let hash = self.digest.fixed_result();
let hash = self.digest.finalize_fixed();
opad_digest.update(&hash);
Output::new(opad_digest.fixed_result())
Output::new(opad_digest.finalize_fixed())
}

#[inline]
Expand Down
6 changes: 3 additions & 3 deletions pmac/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//!
//! // `result` has type `Output` which is a thin wrapper around array of
//! // bytes for providing constant time equality check
//! let result = mac.result();
//! let result = mac.finalize();
//! // To get underlying array use `into_bytes` method, but be careful, since
//! // incorrect use of the tag value may permit timing attacks which defeat
//! // the security provided by the `Output` wrapper
Expand All @@ -32,7 +32,7 @@
//!
//! mac.update(b"input message");
//!
//! # let tag_bytes = mac.clone().result().into_bytes();
//! # let tag_bytes = mac.clone().finalize().into_bytes();
//! // `verify` will return `Ok(())` if tag is correct, `Err(MacError)` otherwise
//! mac.verify(&tag_bytes).unwrap();
//! ```
Expand Down Expand Up @@ -229,7 +229,7 @@ where
}
}

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