mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-28 01:25:18 +00:00
Reduce prime check iterations to 1
This commit is contained in:
parent
5d9659d118
commit
a8f91fe50a
@ -112,7 +112,7 @@ pub fn create_discriminant<T: BigNumExt>(seed: &[u8], length: u16) -> T {
|
|||||||
if !x {
|
if !x {
|
||||||
let q = u64::from(M) * u64::from(i as u32);
|
let q = u64::from(M) * u64::from(i as u32);
|
||||||
n = n + q;
|
n = n + q;
|
||||||
if n.probab_prime(2) {
|
if n.probab_prime(1) {
|
||||||
return -n;
|
return -n;
|
||||||
}
|
}
|
||||||
n = n - q;
|
n = n - q;
|
||||||
|
@ -119,7 +119,7 @@ fn hash_prime<T: BigNum>(seed: &[&[u8]]) -> T {
|
|||||||
hasher.input(i);
|
hasher.input(i);
|
||||||
}
|
}
|
||||||
let n = T::from(&hasher.fixed_result()[..16]);
|
let n = T::from(&hasher.fixed_result()[..16]);
|
||||||
if n.probab_prime(2) {
|
if n.probab_prime(1) {
|
||||||
break n;
|
break n;
|
||||||
}
|
}
|
||||||
j += 1;
|
j += 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user