Skip to content

Commit

Permalink
Align agg param encoding for Poplar1 with VDAF-13 (#1171)
Browse files Browse the repository at this point in the history
The encoding of the prefixes has been simplified by avoiding splitting a
prefix across a byte boundary. Each prefix is now zero-padded to the
next byte.

Also, re-enable test vectors for Poplar1 and IDPF.
  • Loading branch information
cjpatton authored Dec 19, 2024
1 parent f9d4f87 commit 94d77ce
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 106 deletions.
22 changes: 10 additions & 12 deletions src/idpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,6 @@ mod tests {
convert::TryInto,
io::Cursor,
ops::{Add, AddAssign, Sub},
str::FromStr,
sync::Mutex,
};

Expand All @@ -1133,7 +1132,6 @@ mod tests {
bitbox,
prelude::{BitBox, Lsb0},
slice::BitSlice,
vec::BitVec,
};
use num_bigint::BigUint;
use rand::random;
Expand Down Expand Up @@ -2011,14 +2009,15 @@ mod tests {
.try_into()
.unwrap();

let alpha_str = test_vec_obj.get("alpha").unwrap().as_str().unwrap();
let alpha_bignum = BigUint::from_str(alpha_str).unwrap();
let zero_bignum = BigUint::from(0u8);
let one_bignum = BigUint::from(1u8);
let alpha_bits = (0..bits)
.map(|level| (&alpha_bignum >> (bits - level - 1)) & &one_bignum != zero_bignum)
.collect::<BitVec>();
let alpha = alpha_bits.into();
let alpha_bools = test_vec_obj
.get("alpha")
.unwrap()
.as_array()
.unwrap()
.iter()
.map(|value| value.as_bool().unwrap())
.collect::<Vec<_>>();
let alpha = IdpfInput::from_bools(&alpha_bools);

let beta_inner_level_array = test_vec_obj.get("beta_inner").unwrap().as_array().unwrap();
let beta_inner = beta_inner_level_array
Expand Down Expand Up @@ -2067,7 +2066,7 @@ mod tests {
let ctx_hex = test_vec_obj.get("ctx").unwrap();
let ctx = hex::decode(ctx_hex.as_str().unwrap()).unwrap();

let nonce_hex = test_vec_obj.get("binder").unwrap();
let nonce_hex = test_vec_obj.get("nonce").unwrap();
let nonce = hex::decode(nonce_hex.as_str().unwrap()).unwrap();

IdpfTestVector {
Expand All @@ -2082,7 +2081,6 @@ mod tests {
}
}

#[ignore]
#[test]
fn idpf_bbcggi21_generate_test_vector() {
let test_vector = load_idpfbbcggi21_test_vector();
Expand Down
Loading

0 comments on commit 94d77ce

Please sign in to comment.