diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/hash_chain.rs | 6 | ||||
| -rw-r--r-- | src/ui.rs | 2 |
2 files changed, 4 insertions, 4 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 @@ -62,7 +62,7 @@ impl Ui { if let Some(cmd) = cmd.get(1) { if *cmd == "verify" { bc.verify( - bc.last() + &bc.last() .unwrap() .0 .clone(), |
