Impl is_odd for dfg::Scalar

This commit is contained in:
Luke Parker 2022-08-31 01:05:30 -04:00
parent faa43b6874
commit a59bbe7635
No known key found for this signature in database
GPG key ID: F9F1386DB1E119B6
3 changed files with 4 additions and 4 deletions

View file

@ -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;

View file

@ -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()

View file

@ -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" }