Relocate Pedersen hash personalization enum.
This commit is contained in:
parent
8cbcd7739c
commit
69010d1502
|
@ -9,13 +9,7 @@ use bellman::{
|
|||
ConstraintSystem
|
||||
};
|
||||
use super::lookup::*;
|
||||
|
||||
// TODO: ensure these match the spec
|
||||
pub enum Personalization {
|
||||
NoteCommitment,
|
||||
AnotherPersonalization,
|
||||
MerkleTree(usize)
|
||||
}
|
||||
pub use pedersen_hash::Personalization;
|
||||
|
||||
impl Personalization {
|
||||
fn get_constant_bools(&self) -> Vec<Boolean> {
|
||||
|
@ -24,17 +18,6 @@ impl Personalization {
|
|||
.map(|e| Boolean::constant(e))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn get_bits(&self) -> Vec<bool> {
|
||||
match *self {
|
||||
Personalization::NoteCommitment =>
|
||||
vec![false, false, false, false, false, false],
|
||||
Personalization::AnotherPersonalization =>
|
||||
vec![false, false, false, false, false, true],
|
||||
Personalization::MerkleTree(_) =>
|
||||
vec![false, false, false, false, true, false],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pedersen_hash<E: JubjubEngine, CS>(
|
||||
|
|
|
@ -1,7 +1,24 @@
|
|||
use jubjub::*;
|
||||
use pairing::*;
|
||||
|
||||
pub use circuit::pedersen_hash::Personalization;
|
||||
pub enum Personalization {
|
||||
NoteCommitment,
|
||||
AnotherPersonalization,
|
||||
MerkleTree(usize)
|
||||
}
|
||||
|
||||
impl Personalization {
|
||||
pub fn get_bits(&self) -> Vec<bool> {
|
||||
match *self {
|
||||
Personalization::NoteCommitment =>
|
||||
vec![false, false, false, false, false, false],
|
||||
Personalization::AnotherPersonalization =>
|
||||
vec![false, false, false, false, false, true],
|
||||
Personalization::MerkleTree(_) =>
|
||||
vec![false, false, false, false, true, false],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pedersen_hash<E, I>(
|
||||
personalization: Personalization,
|
||||
|
|
Loading…
Reference in New Issue