Switch RO to use the one in the Group trait (#54)

* switch to RO in the Group trait

* simplify compression

* absorb IO as bignum for relaxedR1CS
This commit is contained in:
Srinath Setty
2022-05-13 14:19:34 +05:30
committed by GitHub
parent 82b7fabd9d
commit 677fe23673
7 changed files with 144 additions and 80 deletions

View File

@@ -99,6 +99,20 @@ where
})
}
/// interepret scalar as base
pub fn scalar_as_base<G: Group>(input: G::Scalar) -> G::Base {
let input_bits = input.to_le_bits();
let mut mult = G::Base::one();
let mut val = G::Base::zero();
for bit in input_bits {
if bit {
val += mult;
}
mult = mult + mult;
}
val
}
/// Allocate bignat a constant
pub fn alloc_bignat_constant<F: PrimeField, CS: ConstraintSystem<F>>(
mut cs: CS,