Skip to content

Commit

Permalink
Replace redundant code with call to Field::random() which does the sa…
Browse files Browse the repository at this point in the history
…me as the code.
  • Loading branch information
narodnik committed May 3, 2021
1 parent 3b02c8b commit 618a616
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions zcash_primitives/src/sapling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub mod util;
use bitvec::{order::Lsb0, view::AsBits};
use blake2s_simd::Params as Blake2sParams;
use byteorder::{LittleEndian, WriteBytesExt};
use ff::PrimeField;
use ff::{Field, PrimeField};
use group::{Curve, Group, GroupEncoding};
use lazy_static::lazy_static;
use rand_core::{CryptoRng, RngCore};
Expand Down Expand Up @@ -471,12 +471,7 @@ impl Note {
pub(crate) fn generate_or_derive_esk_internal<R: RngCore>(&self, rng: &mut R) -> jubjub::Fr {
match self.derive_esk() {
None => {
// create random 64 byte buffer
let mut buffer = [0u8; 64];
rng.fill_bytes(&mut buffer);

// reduce to uniform value
jubjub::Fr::from_bytes_wide(&buffer)
jubjub::Fr::random(rng)
}
Some(esk) => esk,
}
Expand Down

0 comments on commit 618a616

Please sign in to comment.