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

Piano: Extremely Simple, Single-server PIR with Sublinear Server Computation #196

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

cxiao129
Copy link

Piano: Extremely Simple, Single-server PIR with Sublinear Server Computation

Copy link

github-actions bot commented Oct 29, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@cxiao129
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@qxzhou1010 qxzhou1010 left a 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);
Copy link
Contributor

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
Copy link
Contributor

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;
Copy link
Contributor

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);
Copy link
Contributor

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>;
Copy link
Contributor

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);
Copy link
Contributor

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


class QueryServiceClient {
public:
static constexpr uint64_t FailureProbLog2 = 40;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kFailureProbLog2

class QueryServiceClient {
public:
static constexpr uint64_t FailureProbLog2 = 40;
uint64_t totalQueryNum{};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请放在private


std::vector<LocalSet> primary_sets_;
std::vector<LocalBackupSet> local_backup_sets_;
std::map<uint64_t, DBEntry> local_cache_;
Copy link
Contributor

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

放在 private 下,或者用 struct 即可

return entry;
}

uint64_t DefaultHash(uint64_t key) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个方法的出处是?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants