mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-07-31 12:31:22 +00:00
impl ConditionallySelectable for Field
This commit is contained in:
@@ -6,6 +6,7 @@ use ff::{
|
||||
};
|
||||
use rand_core::RngCore;
|
||||
use std::ops::{Add, AddAssign, Mul, MulAssign, Neg, Sub, SubAssign};
|
||||
use subtle::{Choice, ConditionallySelectable};
|
||||
|
||||
use super::ToUniform;
|
||||
|
||||
@@ -269,6 +270,17 @@ impl From<Fs> for FsRepr {
|
||||
}
|
||||
}
|
||||
|
||||
impl ConditionallySelectable for Fs {
|
||||
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self {
|
||||
Fs(FsRepr([
|
||||
u64::conditional_select(&(a.0).0[0], &(b.0).0[0], choice),
|
||||
u64::conditional_select(&(a.0).0[1], &(b.0).0[1], choice),
|
||||
u64::conditional_select(&(a.0).0[2], &(b.0).0[2], choice),
|
||||
u64::conditional_select(&(a.0).0[3], &(b.0).0[3], choice),
|
||||
]))
|
||||
}
|
||||
}
|
||||
|
||||
impl Neg for Fs {
|
||||
type Output = Self;
|
||||
|
||||
|
Reference in New Issue
Block a user