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