Skip to content

Commit

Permalink
Merge pull request zcash#29 from ebfull/pedersen-chunks
Browse files Browse the repository at this point in the history
63 chunks per pedersen hash segment
  • Loading branch information
ebfull authored Feb 20, 2018
2 parents c091e27 + 821d222 commit 8d633db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/jubjub/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl JubjubParams<Bls12> for JubjubBls12 {
&self.pedersen_hash_generators
}
fn pedersen_hash_chunks_per_generator(&self) -> usize {
62
63
}
fn fixed_base_chunks_per_generator(&self) -> usize {
84
Expand Down
14 changes: 10 additions & 4 deletions src/jubjub/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,16 @@ fn test_jubjub_params<E: JubjubEngine>(params: &E::Params) {
// Check that the number of windows per generator
// in the Pedersen hash does not allow for collisions

let mut cur = E::Fr::one().into_repr();
let mut cur = E::Fs::one().into_repr();

let mut pacc = E::Fr::zero().into_repr();
let mut nacc = E::Fr::char();
let mut max = E::Fs::char();
{
max.sub_noborrow(&E::Fs::one().into_repr());
max.div2();
}

let mut pacc = E::Fs::zero().into_repr();
let mut nacc = E::Fs::char();

for _ in 0..params.pedersen_hash_chunks_per_generator()
{
Expand All @@ -371,7 +377,7 @@ fn test_jubjub_params<E: JubjubEngine>(params: &E::Params) {
assert_eq!(pacc.add_nocarry(&tmp), false);
assert_eq!(nacc.sub_noborrow(&tmp), false);

assert!(pacc < E::Fr::char());
assert!(pacc < max);
assert!(pacc < nacc);

// cur = cur * 16
Expand Down

0 comments on commit 8d633db

Please sign in to comment.