diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-10-23 22:16:18 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-10-23 22:16:18 +0800 |
| commit | 653e79c3e0515cc33b9915973c8e43021f8f2a87 (patch) | |
| tree | 3bd889ed89d63bbe42c668760b8b78ea502de9e8 /src/hash_chain.rs | |
| parent | cadbb7e78aca4378364c8d55503824fb55d30e38 (diff) | |
refactor: just use &[T]
Diffstat (limited to 'src/hash_chain.rs')
| -rw-r--r-- | src/hash_chain.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hash_chain.rs b/src/hash_chain.rs index e0ae1f2..e3a743c 100644 --- a/src/hash_chain.rs +++ b/src/hash_chain.rs @@ -40,7 +40,7 @@ impl<T: Encode> HashChain<T> { // TODO: make try_last that does same as this but returns Err() if it's not the // last one and/or refuse to insert - pub fn insert(&mut self, data: T, base_hash: &Vec<u8>) { + pub fn insert(&mut self, data: T, base_hash: &[u8]) { let pos = self .data .iter() @@ -53,7 +53,7 @@ impl<T: Encode> HashChain<T> { self.rehash(&base_hash); } - pub fn verify(&self, until_hash: Vec<u8>) -> bool { + pub fn verify(&self, until_hash: &[u8]) -> bool { let pos = self .data .iter() @@ -92,7 +92,7 @@ impl<T: Encode> HashChain<T> { }); } - pub fn hash_item(data: (&Vec<u8>, &T)) -> Vec<u8> { + pub fn hash_item(data: (&[u8], &T)) -> Vec<u8> { let mut hasher = Sha256::new(); hasher.update(bincode::encode_to_vec(data, bincode::config::standard()).unwrap()); hasher |
