Skip to content

Commit

Permalink
Update dpf (#238)
Browse files Browse the repository at this point in the history
* Update ea_code.h

* Update ea_code.h

* Update dpf.h

* Update dpf.cc
  • Loading branch information
maths644311798 authored Jan 23, 2024
1 parent c1721d4 commit f1ac665
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions yacl/crypto/primitives/dpf/dpf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ void DpfContext::Gen(DpfKey& first_key, DpfKey& second_key, DpfInStore alpha,
DpfOutStore beta, uint128_t first_mk, uint128_t second_mk,
bool enable_evalall) {
YACL_ENFORCE(this->in_bitnum_ > 0);
YACL_ENFORCE(this->in_bitnum_ > log(alpha));
YACL_ENFORCE(this->in_bitnum_ < 64);
YACL_ENFORCE(this->in_bitnum_ > log2(alpha));
YACL_ENFORCE(this->in_bitnum_ <= 64);
YACL_ENFORCE(this->ss_bitnum_ > 0);
YACL_ENFORCE(this->ss_bitnum_ <= 64);

Expand Down Expand Up @@ -183,7 +183,7 @@ void DpfContext::Gen(DpfKey& first_key, DpfKey& second_key, DpfInStore alpha,
} // namespace flcrypto

DpfOutStore DpfContext::Eval(DpfKey& key, DpfInStore x) {
YACL_ENFORCE(this->in_bitnum_ > log(x));
YACL_ENFORCE(this->in_bitnum_ > log2(x));
YACL_ENFORCE(key.enable_evalall == false);

uint128_t seed_working = key.GetSeed(); // the initial value
Expand Down
2 changes: 1 addition & 1 deletion yacl/crypto/primitives/dpf/dpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace yacl::crypto {
//
// Assume we have a function F(*), where F(alpha)=beta, F(*!=alpha)=0.
// DPF splits the finction into two parts F1 and F2, and ensures F1(alpha)=r,
// F2(alpha)=r+beta, and F1(*!=alpha)=r, F2(*!=alpha)=-r
// F2(alpha)=-r+beta, and F1(*!=alpha)=r, F2(*!=alpha)=-r
//
// alpha : arbitrary length mapping input
// beta : 128bit mapping output
Expand Down

0 comments on commit f1ac665

Please sign in to comment.