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

Make sharding function configurable #15

Merged
merged 1 commit into from
Nov 12, 2024
Merged
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
28 changes: 27 additions & 1 deletion apple/swift_homomorphic_encryption/pir/v1/pir.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,33 @@ message PirParameters {
message KeywordPirParameters {
// The number of hash functions used.
uint64 num_hash_functions = 1;
reserved 2, 3, 4;
reserved 2, 3;
// The sharding function to use.
PIRShardingFunction sharding_function = 4;
}

// Configuration for the sharding function.
message PIRShardingFunction {
// Sharding function to use.
oneof function {
// Sharding based on SHA256 hash of the keyword.
PIRShardingFunctionSHA256 sha256 = 1;
// Sharding depends on a different usecase.
PIRShardingFunctionDoubleMod double_mod = 2;
}
}

// SHA256 sharding function.
//
// shard_id = (truncate(SHA256(keyword)) % shard_count).
message PIRShardingFunctionSHA256 {}

// Double mod sharding function.
//
// shard_id = (truncate(SHA256(keyword)) % other_shard_count) % shard_count.
message PIRShardingFunctionDoubleMod {
// Number of shards in the other usecase.
uint32 other_shard_count = 1;
}

// Encrypted PIR index.
Expand Down
Loading