Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional test vectors for Prio3 #463

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion poc/gen_test_vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def gen_test_vec_for_xof(cls: type[Xof]) -> None:
ctx = b'some application'
vdaf_test_vec_path = TEST_VECTOR_PATH + "/vdaf/"

# Prio3 variants
# Prio3Count
gen_test_vec_for_vdaf(
vdaf_test_vec_path,
vdaf_prio3.Prio3Count(2),
Expand All @@ -119,6 +119,16 @@ def gen_test_vec_for_xof(cls: type[Xof]) -> None:
[1],
1,
)
gen_test_vec_for_vdaf(
vdaf_test_vec_path,
vdaf_prio3.Prio3Count(2),
None,
ctx,
[0, 1, 1, 0, 1],
2,
)

# Prio3Sum
gen_test_vec_for_vdaf(
vdaf_test_vec_path,
vdaf_prio3.Prio3Sum(2, 255),
Expand All @@ -135,6 +145,16 @@ def gen_test_vec_for_xof(cls: type[Xof]) -> None:
[100],
1,
)
gen_test_vec_for_vdaf(
vdaf_test_vec_path,
vdaf_prio3.Prio3Sum(2, 1337),
None,
ctx,
[0, 1, 1337, 99, 42, 0, 0, 42],
2,
)

# Prio3SumVec
gen_test_vec_for_vdaf(
vdaf_test_vec_path,
vdaf_prio3.Prio3SumVec(2, 10, 8, 9),
Expand All @@ -159,6 +179,8 @@ def gen_test_vec_for_xof(cls: type[Xof]) -> None:
],
1,
)

# Prio3Histogram
gen_test_vec_for_vdaf(
vdaf_test_vec_path,
vdaf_prio3.Prio3Histogram(2, 4, 2),
Expand All @@ -175,6 +197,16 @@ def gen_test_vec_for_xof(cls: type[Xof]) -> None:
[2],
1,
)
gen_test_vec_for_vdaf(
vdaf_test_vec_path,
vdaf_prio3.Prio3Histogram(2, 100, 10),
None,
ctx,
[2, 99, 99, 17, 42, 0, 0, 1, 2, 0],
2,
)

# Prio3MultihotCountVec
gen_test_vec_for_vdaf(
vdaf_test_vec_path,
vdaf_prio3.Prio3MultihotCountVec(2, 4, 2, 2),
Expand All @@ -183,6 +215,28 @@ def gen_test_vec_for_xof(cls: type[Xof]) -> None:
[[0, 1, 1, 0]],
0,
)
gen_test_vec_for_vdaf(
vdaf_test_vec_path,
vdaf_prio3.Prio3MultihotCountVec(4, 10, 2, 3),
None,
ctx,
[[0, 1, 0, 0, 0, 0, 0, 0, 0, 1]],
1,
)
gen_test_vec_for_vdaf(
vdaf_test_vec_path,
vdaf_prio3.Prio3MultihotCountVec(2, 4, 4, 1),
None,
ctx,
[
[0, 1, 1, 0],
[0, 0, 1, 0],
[0, 0, 0, 0],
[1, 1, 1, 0],
[1, 1, 1, 1],
],
2,
)

# Poplar1
poplar1_test_number = 0
Expand Down
2 changes: 1 addition & 1 deletion poc/vdaf_poc/flp_bbcggi19.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,5 +1147,5 @@ def decode(self, output: list[F], _num_measurements: int) -> int:
return output[0].as_unsigned()

def test_vec_set_type_param(self, test_vec: dict[str, Any]) -> list[str]:
test_vec['max_measurement'] = int(self.MEAS_LEN)
test_vec['max_measurement'] = int(self.max_measurement)
return ['max_measurement']
148 changes: 148 additions & 0 deletions test_vec/vdaf/Prio3Count_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"agg_param": "",
"agg_result": 3,
"agg_shares": [
"6b111b08d94ff4ed",
"99eee4f725b00b12"
],
"ctx": "736f6d65206170706c69636174696f6e",
"prep": [
{
"input_shares": [
"e269056891a9fd95d44e6fadb3b75e6774b666d312bcc59b04b52413d9e5e26d6f46b3fd26db6150a8659ad79dae8621",
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
],
"measurement": 0,
"nonce": "000102030405060708090a0b0c0d0e0f",
"out_shares": [
[
"e269056891a9fd95"
],
[
"1f96fa976d56026a"
]
],
"prep_messages": [
""
],
"prep_shares": [
[
"5c6a0685bd0f0aa98bb9c0942022d854c6be57b0c1d149b3d5a14867e2750b29",
"a595f97a41f0f5565abc07086ef01d5b3cb2629a3c534bd4dbd8f5187ad75aad"
]
],
"public_share": "",
"rand": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
},
{
"input_shares": [
"e369056891a9fd95d44e6fadb3b75e6774b666d312bcc59b57694d189321ffe06f46b37d26db61d056b17152e3726a2e",
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
],
"measurement": 1,
"nonce": "000102030405060708090a0b0c0d0e0f",
"out_shares": [
[
"e369056891a9fd95"
],
[
"1f96fa976d56026a"
]
],
"prep_messages": [
""
],
"prep_shares": [
[
"5c6a0685bd0f0aa9b19b8c1c4431ec49eca02338e5e05da8fc91575311627200",
"a595f97a41f0f5565abc07086ef01d5b3cb2629a3c534bd4dbd8f5187ad75aad"
]
],
"public_share": "",
"rand": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
},
{
"input_shares": [
"e369056891a9fd95d44e6fadb3b75e6774b666d312bcc59b57694d189321ffe06f46b37d26db61d056b17152e3726a2e",
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
],
"measurement": 1,
"nonce": "000102030405060708090a0b0c0d0e0f",
"out_shares": [
[
"e369056891a9fd95"
],
[
"1f96fa976d56026a"
]
],
"prep_messages": [
""
],
"prep_shares": [
[
"5c6a0685bd0f0aa9b19b8c1c4431ec49eca02338e5e05da8fc91575311627200",
"a595f97a41f0f5565abc07086ef01d5b3cb2629a3c534bd4dbd8f5187ad75aad"
]
],
"public_share": "",
"rand": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
},
{
"input_shares": [
"e269056891a9fd95d44e6fadb3b75e6774b666d312bcc59b04b52413d9e5e26d6f46b3fd26db6150a8659ad79dae8621",
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
],
"measurement": 0,
"nonce": "000102030405060708090a0b0c0d0e0f",
"out_shares": [
[
"e269056891a9fd95"
],
[
"1f96fa976d56026a"
]
],
"prep_messages": [
""
],
"prep_shares": [
[
"5c6a0685bd0f0aa98bb9c0942022d854c6be57b0c1d149b3d5a14867e2750b29",
"a595f97a41f0f5565abc07086ef01d5b3cb2629a3c534bd4dbd8f5187ad75aad"
]
],
"public_share": "",
"rand": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
},
{
"input_shares": [
"e369056891a9fd95d44e6fadb3b75e6774b666d312bcc59b57694d189321ffe06f46b37d26db61d056b17152e3726a2e",
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
],
"measurement": 1,
"nonce": "000102030405060708090a0b0c0d0e0f",
"out_shares": [
[
"e369056891a9fd95"
],
[
"1f96fa976d56026a"
]
],
"prep_messages": [
""
],
"prep_shares": [
[
"5c6a0685bd0f0aa9b19b8c1c4431ec49eca02338e5e05da8fc91575311627200",
"a595f97a41f0f5565abc07086ef01d5b3cb2629a3c534bd4dbd8f5187ad75aad"
]
],
"public_share": "",
"rand": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
}
],
"shares": 2,
"verify_key": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
}
Loading