Skip to content

Commit 2d82679

Browse files
JakobDegenfacebook-github-bot
authored andcommitted
strong hash: Delete StrongHasher
Summary: I said this in code review at the time, but especially since D73095294 it's literally just dead code Reviewed By: samkevich Differential Revision: D73634797 fbshipit-source-id: e4db2ce5e16e5fc0198efd73a37ba709e437cbcc
1 parent c5ef209 commit 2d82679

File tree

2 files changed

+2
-37
lines changed

2 files changed

+2
-37
lines changed

gazebo/strong_hash/src/lib.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,6 @@ use crate as strong_hash;
2121

2222
mod impls;
2323

24-
/// `StrongHasher` is a trait for hashing functions that return more than 64
25-
/// bits of output. The key difference between `std::hash::Hasher` and
26-
/// `StrongHasher` is that `StrongHasher` produces a vec of bytes as the hash.
27-
///
28-
/// For example, a `DefaultHasher` implementation of `StrongHasher` is as follows.
29-
///
30-
/// ```ignore
31-
/// struct DefaultHasher2 {
32-
/// hasher: DefaultHasher,
33-
/// }
34-
///
35-
/// impl StrongHasher for DefaultHasher2 {
36-
/// fn finish(self) -> Vec<u8> {
37-
/// self.hasher.finish().to_le_bytes().to_vec()
38-
/// }
39-
/// }
40-
/// ```
41-
pub trait StrongHasher: Hasher {
42-
/// Finishes the hash and returns the hash in bytes as a `Vec<u8>`.
43-
fn finish(&self) -> Vec<u8>;
44-
}
45-
46-
impl<H: StrongHasher + ?Sized> StrongHasher for &mut H {
47-
fn finish(&self) -> Vec<u8> {
48-
StrongHasher::finish(*self)
49-
}
50-
}
51-
5224
/// `StrongHash`` is a trait that is notionally similar to `std::hash::Hash`,
5325
/// but carries the implicit expectation that the hash that will be produced
5426
/// should be as perturbed as possible.

gazebo/strong_hash_tests/src/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use std::hash::Hasher;
1313

1414
use strong_hash::StrongHash;
15-
use strong_hash::StrongHasher;
1615

1716
#[test]
1817
fn test_strong_hash_derive() {
@@ -60,16 +59,10 @@ fn test_strong_hash_derive() {
6059
}
6160
}
6261

63-
impl StrongHasher for Blake3StrongHasher {
64-
fn finish(&self) -> Vec<u8> {
65-
self.digest().as_bytes().into()
66-
}
67-
}
68-
69-
fn hash(hashable: &impl StrongHash) -> Vec<u8> {
62+
fn hash(hashable: &impl StrongHash) -> u64 {
7063
let mut hasher = Blake3StrongHasher::new();
7164
hashable.strong_hash(&mut hasher);
72-
StrongHasher::finish(&hasher)
65+
Hasher::finish(&hasher)
7366
}
7467

7568
// Now test that hashes are not equal

0 commit comments

Comments
 (0)