-
Notifications
You must be signed in to change notification settings - Fork 25
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
Piano: Extremely Simple, Single-server PIR with Sublinear Server Computation #196
base: main
Are you sure you want to change the base?
Conversation
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请把piano
的实现整体放在 psi/experimental/
目录下
psi/piano/util.h
Outdated
std::string Uint128ToBytes(uint128_t value); | ||
|
||
// Generates a random 128-bit key using the provided RNG | ||
PrfKey128 RandKey128(std::mt19937_64& rng); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用yacl::crypto::Prg
,其余涉及到 rng 到地方也替换为同样的Prg
.
psi/piano/util.h
Outdated
|
||
namespace psi::piano { | ||
|
||
constexpr size_t DBEntrySize = 8; // has to be a multiple of 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里指的是数据库里一行数据的长度吗?单位是 bit 还是 字节?以及这里取8的出处是?
psi/piano/util.h
Outdated
constexpr size_t DBEntrySize = 8; // has to be a multiple of 8 | ||
constexpr size_t DBEntryLength = DBEntrySize / 8; | ||
|
||
using PrfKey128 = uint128_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
引入这个头文件#include "yacl/base/int128.h"
,显式的使用yacl里提供的uint128_t
这个类型
psi/piano/util.h
Outdated
PrfKey RandKey(std::mt19937_64& rng); | ||
|
||
// Evaluates PRF using 128-bit key and returns a 64-bit result | ||
uint64_t PRFEval128(const PrfKey128* key, uint64_t x); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对于 uint128_t 来说,可以直接pass by value
,不必使用pointer
psi/piano/util.h
Outdated
constexpr size_t DBEntryLength = DBEntrySize / 8; | ||
|
||
using PrfKey128 = uint128_t; | ||
using DBEntry = std::array<uint64_t, DBEntryLength>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看到了后面大量的关于DBEntry
相关的操作。是否可以考虑,将DBEntry
进一步抽象为一个class
或者 struct
?
psi/piano/util.h
Outdated
using DBEntry = std::array<uint64_t, DBEntryLength>; | ||
using PrfKey = PrfKey128; | ||
|
||
uint128_t BytesToUint128(const std::string& bytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用 yacl中ByteContainerView
,或者std::vector<uint8_t>
来表示 bytes,而不是std::string
psi/piano/client.h
Outdated
|
||
class QueryServiceClient { | ||
public: | ||
static constexpr uint64_t FailureProbLog2 = 40; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kFailureProbLog2
psi/piano/client.h
Outdated
class QueryServiceClient { | ||
public: | ||
static constexpr uint64_t FailureProbLog2 = 40; | ||
uint64_t totalQueryNum{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请放在private
下
psi/piano/client.h
Outdated
|
||
std::vector<LocalSet> primary_sets_; | ||
std::vector<LocalBackupSet> local_backup_sets_; | ||
std::map<uint64_t, DBEntry> local_cache_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果不要求有序,使用std::unordered_map
即可
psi/piano/util.h
Outdated
|
||
class PRSetWithShortTag { | ||
public: | ||
uint32_t Tag; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
放在 private 下,或者用 struct
即可
psi/piano/util.cc
Outdated
return entry; | ||
} | ||
|
||
uint64_t DefaultHash(uint64_t key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个方法的出处是?
Piano: Extremely Simple, Single-server PIR with Sublinear Server Computation