Skip to content

Commit

Permalink
[share_backup] decode on 32bit arch
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfarrow committed Jan 16, 2024
1 parent 3e5e9f8 commit b99b587
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 6 additions & 3 deletions schnorr_fun/src/share_backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,12 @@ pub fn decode_backup(

let mut threshold_bytes =
Vec::<u8>::from_base32(&data[..2]).map_err(FrostBackupDecodeError::Bech32DecodeError)?;
threshold_bytes.extend(vec![0; 8 - threshold_bytes.len()]);
let threshold =
1 + usize::from_le_bytes(threshold_bytes.try_into().expect("8 bytes must fit u8"));
threshold_bytes.resize((usize::BITS / 8) as usize, 0);
let threshold = 1 + usize::from_le_bytes(
threshold_bytes
.try_into()
.expect("(usize::BITS / 8) bytes must fit usize"),
);

let identifier: [u5; 4] = data[2..(2 + 4)].try_into().expect("4 bytes has to fit");

Expand Down
2 changes: 0 additions & 2 deletions secp256kfun/src/poly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,6 @@ mod test {

let interpolation = poly::point::interpolate(points);

dbg!(&poly);
dbg!(&interpolation);
let (interpolated_coeffs, zero_coeffs) = interpolation.split_at(poly.len());
let n_extra_points = indicies.len() - poly.len();
assert_eq!(
Expand Down

0 comments on commit b99b587

Please sign in to comment.