Skip to content

Commit e043f0d

Browse files
authored
Make sharding function configurable (#15)
1 parent 122bd5f commit e043f0d

File tree

1 file changed

+27
-1
lines changed
  • apple/swift_homomorphic_encryption/pir/v1

1 file changed

+27
-1
lines changed

apple/swift_homomorphic_encryption/pir/v1/pir.proto

+27-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,33 @@ message PirParameters {
5858
message KeywordPirParameters {
5959
// The number of hash functions used.
6060
uint64 num_hash_functions = 1;
61-
reserved 2, 3, 4;
61+
reserved 2, 3;
62+
// The sharding function to use.
63+
PIRShardingFunction sharding_function = 4;
64+
}
65+
66+
// Configuration for the sharding function.
67+
message PIRShardingFunction {
68+
// Sharding function to use.
69+
oneof function {
70+
// Sharding based on SHA256 hash of the keyword.
71+
PIRShardingFunctionSHA256 sha256 = 1;
72+
// Sharding depends on a different usecase.
73+
PIRShardingFunctionDoubleMod double_mod = 2;
74+
}
75+
}
76+
77+
// SHA256 sharding function.
78+
//
79+
// shard_id = (truncate(SHA256(keyword)) % shard_count).
80+
message PIRShardingFunctionSHA256 {}
81+
82+
// Double mod sharding function.
83+
//
84+
// shard_id = (truncate(SHA256(keyword)) % other_shard_count) % shard_count.
85+
message PIRShardingFunctionDoubleMod {
86+
// Number of shards in the other usecase.
87+
uint32 other_shard_count = 1;
6288
}
6389

6490
// Encrypted PIR index.

0 commit comments

Comments
 (0)