Replace redundant code with call to Field::random() which does the same as the code.
This commit is contained in:
parent
3b02c8b26e
commit
618a6165c7
|
@ -11,7 +11,7 @@ pub mod util;
|
||||||
use bitvec::{order::Lsb0, view::AsBits};
|
use bitvec::{order::Lsb0, view::AsBits};
|
||||||
use blake2s_simd::Params as Blake2sParams;
|
use blake2s_simd::Params as Blake2sParams;
|
||||||
use byteorder::{LittleEndian, WriteBytesExt};
|
use byteorder::{LittleEndian, WriteBytesExt};
|
||||||
use ff::PrimeField;
|
use ff::{Field, PrimeField};
|
||||||
use group::{Curve, Group, GroupEncoding};
|
use group::{Curve, Group, GroupEncoding};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use rand_core::{CryptoRng, RngCore};
|
use rand_core::{CryptoRng, RngCore};
|
||||||
|
@ -471,12 +471,7 @@ impl Note {
|
||||||
pub(crate) fn generate_or_derive_esk_internal<R: RngCore>(&self, rng: &mut R) -> jubjub::Fr {
|
pub(crate) fn generate_or_derive_esk_internal<R: RngCore>(&self, rng: &mut R) -> jubjub::Fr {
|
||||||
match self.derive_esk() {
|
match self.derive_esk() {
|
||||||
None => {
|
None => {
|
||||||
// create random 64 byte buffer
|
jubjub::Fr::random(rng)
|
||||||
let mut buffer = [0u8; 64];
|
|
||||||
rng.fill_bytes(&mut buffer);
|
|
||||||
|
|
||||||
// reduce to uniform value
|
|
||||||
jubjub::Fr::from_bytes_wide(&buffer)
|
|
||||||
}
|
}
|
||||||
Some(esk) => esk,
|
Some(esk) => esk,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue