From a59bbe7635ebf1c95a52699b3901f6a317dcef30 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 31 Aug 2022 01:05:30 -0400 Subject: [PATCH] Impl is_odd for dfg::Scalar --- crypto/dalek-ff-group/src/field.rs | 4 ++-- crypto/dalek-ff-group/src/lib.rs | 2 +- crypto/ed448/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crypto/dalek-ff-group/src/field.rs b/crypto/dalek-ff-group/src/field.rs index b874c871..527e187f 100644 --- a/crypto/dalek-ff-group/src/field.rs +++ b/crypto/dalek-ff-group/src/field.rs @@ -207,8 +207,8 @@ impl FieldElement { #[test] fn test_conditional_negate() { let one = FieldElement::one(); - let true_choice = choice(true); - let false_choice = choice(false); + let true_choice = 1.into(); + let false_choice = 0.into(); let mut var = one; diff --git a/crypto/dalek-ff-group/src/lib.rs b/crypto/dalek-ff-group/src/lib.rs index 44efedfa..31c8edae 100644 --- a/crypto/dalek-ff-group/src/lib.rs +++ b/crypto/dalek-ff-group/src/lib.rs @@ -244,7 +244,7 @@ impl PrimeField for Scalar { const S: u32 = 2; fn is_odd(&self) -> Choice { - unimplemented!() + choice(self.to_le_bits()[0]) } fn multiplicative_generator() -> Self { 2u64.into() diff --git a/crypto/ed448/Cargo.toml b/crypto/ed448/Cargo.toml index c25b8a2a..945e529f 100644 --- a/crypto/ed448/Cargo.toml +++ b/crypto/ed448/Cargo.toml @@ -22,7 +22,7 @@ ff = "0.12" group = "0.12" generic-array = "0.14" -crypto-bigint = {version = "0.4", features = ["zeroize"] } +crypto-bigint = { version = "0.4", features = ["zeroize"] } dalek-ff-group = { path = "../dalek-ff-group", version = "^0.1.2" }