mirror of
https://github.com/vacp2p/semaphore-rs.git
synced 2025-02-24 01:28:28 +00:00
prepend zeros if bigint too small
This commit is contained in:
parent
caab6aa071
commit
0047d8e7c2
@ -18,7 +18,13 @@ pub fn bigint_to_fr(bi: &BigInt) -> Fr {
|
||||
let m = bi.modpow(&BigInt::from(1), &q);
|
||||
|
||||
let mut repr = FrRepr::default();
|
||||
let (_, res) = m.to_bytes_be();
|
||||
let (_, mut res) = m.to_bytes_be();
|
||||
|
||||
//prepend zeros
|
||||
res.reverse();
|
||||
res.resize(32, 0);
|
||||
res.reverse();
|
||||
|
||||
repr.read_be(&res[..]).unwrap();
|
||||
Fr::from_repr(repr).unwrap()
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user