Relocate Pedersen hash personalization enum.

This commit is contained in:
Sean Bowe 2018-03-05 15:25:40 -07:00
parent 8cbcd7739c
commit 69010d1502
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
2 changed files with 19 additions and 19 deletions

View File

@ -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>(

View File

@ -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,