Skip to content

Commit

Permalink
reset interop module to use be
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray committed Jan 28, 2024
1 parent 9130daf commit 2cf725f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ffi_interface/src/interop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn Java_org_hyperledger_besu_nativelib_ipamultipoint_LibIpaMultipoint_commit
// Each 32-le-bytes are interpreted as field elements.
let mut scalars: Vec<banderwagon::Fr> = Vec::with_capacity(n_scalars);
for b in inp.chunks(32) {
scalars.push(Fr::from_le_bytes_mod_order(b));
scalars.push(Fr::from_be_bytes_mod_order(b));
}

// Committing all values at once.
Expand All @@ -74,6 +74,7 @@ pub fn Java_org_hyperledger_besu_nativelib_ipamultipoint_LibIpaMultipoint_commit
scalar
.serialize_compressed(&mut scalar_bytes[..])
.expect("could not serialise Fr into a 32 byte array");
scalar_bytes.reverse();

scalar_bytes.to_vec()
}
Expand All @@ -99,7 +100,7 @@ pub fn Java_org_hyperledger_besu_nativelib_ipamultipoint_LibIpaMultipoint_commit
// Each 32-le-bytes are interpreted as field elements.
let mut scalars: Vec<Fr> = Vec::with_capacity(n_scalars);
for b in inp.chunks(32) {
scalars.push(Fr::from_le_bytes_mod_order(b));
scalars.push(Fr::from_be_bytes_mod_order(b));
}

// Committing all values at once.
Expand Down Expand Up @@ -156,6 +157,7 @@ mod test {
let val = Fr::from((i + 1) as u128);
fr_to_le_bytes(-val)
})
.flatten()
.collect();

let scalars_be: Vec<_> = (0..256)
Expand Down Expand Up @@ -200,6 +202,7 @@ mod test {
arr.reverse();
arr
})
.flatten()
.collect();

let expected_hash =
Expand Down

0 comments on commit 2cf725f

Please sign in to comment.