Skip to content

Rename *result* to finalize #56

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
156 changes: 78 additions & 78 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions ghash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ impl UniversalHash for GHash {
}

/// Get GHASH output
fn result(self) -> Tag {
let mut output = self.0.result().into_bytes();
fn finalize(self) -> Tag {
let mut output = self.0.finalize().into_bytes();
output.reverse();
Tag::new(output)
}
Expand Down
2 changes: 1 addition & 1 deletion ghash/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ fn ghash_test_vector() {
ghash.update(&X_1.into());
ghash.update(&X_2.into());

let result = ghash.result();
let result = ghash.finalize();
assert_eq!(&GHASH_RESULT[..], result.into_bytes().as_slice());
}
2 changes: 1 addition & 1 deletion poly1305/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl UniversalHash for Poly1305 {
}

/// Get the hashed output
fn result(mut self) -> Tag {
fn finalize(mut self) -> Tag {
self.state.finalize()
}
}
Expand Down
6 changes: 3 additions & 3 deletions poly1305/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn donna_self_test1() {

let mut poly = Poly1305::new(key.as_ref().into());
poly.update(msg.as_ref().into());
assert_eq!(&expected[..], poly.result().into_bytes().as_slice());
assert_eq!(&expected[..], poly.finalize().into_bytes().as_slice());
}

#[test]
Expand All @@ -73,7 +73,7 @@ fn test_tls_vectors() {
poly.update(chunk.into());
}

assert_eq!(&expected[..], poly.result().into_bytes().as_slice());
assert_eq!(&expected[..], poly.finalize().into_bytes().as_slice());
}

#[test]
Expand All @@ -96,5 +96,5 @@ fn padded_input() {

let mut poly = Poly1305::new(key.as_ref().into());
poly.update_padded(&msg);
assert_eq!(&expected[..], poly.result().into_bytes().as_slice());
assert_eq!(&expected[..], poly.finalize().into_bytes().as_slice());
}
2 changes: 1 addition & 1 deletion polyval/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl UniversalHash for Polyval {
}

/// Get POLYVAL result (i.e. computed `S` field element)
fn result(self) -> Tag {
fn finalize(self) -> Tag {
Output::new(self.S.to_bytes().into())
}
}
2 changes: 1 addition & 1 deletion polyval/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ fn polyval_test_vector() {
poly.update(&X_1.into());
poly.update(&X_2.into());

let result = poly.result();
let result = poly.finalize();
assert_eq!(&POLYVAL_RESULT[..], result.into_bytes().as_slice());
}