Skip to content

Commit

Permalink
impl Hash for ValueBase - so we can store them in a hashmap! (#188)
Browse files Browse the repository at this point in the history
* impl Hash for ValueBase - so we can store them in a hashmap!
  • Loading branch information
bazzilic authored Jul 11, 2023
1 parent cce706e commit 6495e72
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion taiga_halo2/src/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ use pasta_curves::{
pallas,
};
use rand::{Rng, RngCore};
use std::io;
use std::{
hash::{Hash, Hasher},
io,
};

/// A commitment to a note.
#[derive(Copy, Debug, Clone)]
Expand Down Expand Up @@ -406,6 +409,13 @@ impl ValueBase {
}
}

impl Hash for ValueBase {
fn hash<H: Hasher>(&self, state: &mut H) {
self.app_vk.to_repr().as_ref().hash(state);
self.app_data_static.to_repr().as_ref().hash(state);
}
}

impl RandomSeed {
pub fn random<R: RngCore>(mut rng: R) -> Self {
let mut rseed = [0; 32];
Expand Down

0 comments on commit 6495e72

Please sign in to comment.