Skip to content

Commit 59ad45e

Browse files
committed
Simplification
1 parent db715bf commit 59ad45e

File tree

2 files changed

+0
-23
lines changed

2 files changed

+0
-23
lines changed

src/toolbox/sigma/sage_test/BLS12_381.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ use bls12_381::G1Projective;
55
use subtle::CtOption;
66
use num_bigint::BigUint;
77
use hex::FromHex;
8-
use num_traits::One;
9-
use crate::rand::RngCore;
108

119
impl SInput for G1Projective {
1210
fn scalar_from_hex_be(
@@ -32,22 +30,6 @@ impl SInput for G1Projective {
3230
}
3331

3432
impl SRandom<TestDRNG> for G1Projective {
35-
fn randint_big(rng: &mut TestDRNG, l: &BigUint, h: &BigUint) -> BigUint {
36-
assert!(l <= h);
37-
let range = h - l + BigUint::one();
38-
let bits = range.bits();
39-
let bytes_needed = ((bits + 7) / 8) as usize;
40-
41-
loop {
42-
let mut buf = vec![0u8; bytes_needed];
43-
rng.fill_bytes(&mut buf);
44-
let val = BigUint::from_bytes_be(&buf);
45-
if val.bits() <= bits {
46-
return l + (val % &range);
47-
}
48-
}
49-
}
50-
5133
fn srandom(
5234
rng: &mut TestDRNG
5335
) -> Self::Scalar {

src/toolbox/sigma/sage_test/random.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use group::{Group, GroupEncoding};
22
use rand::{Rng, CryptoRng};
3-
use num_bigint::BigUint;
43

54
pub trait SInput: Group + GroupEncoding {
65
fn scalar_from_hex_be(
@@ -9,10 +8,6 @@ pub trait SInput: Group + GroupEncoding {
98
}
109

1110
pub trait SRandom<DRNG: Rng + CryptoRng>: Group {
12-
fn randint_big(
13-
rng: &mut DRNG, l: &BigUint, h: &BigUint
14-
) -> BigUint;
15-
1611
fn srandom(
1712
rng: &mut DRNG
1813
) -> Self::Scalar;

0 commit comments

Comments
 (0)