secretflow/yacl

Problems in dpf

maths644311798 opened this issue · 2 comments

(1) In yacl/crypto/primitives/dpf/dpf.h,

// 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

Neither F2 - F1 = F nor F2 + F1 = F.
(2) In dpf.cc,

YACL_ENFORCE(this->in_bitnum_ > log(alpha));
YACL_ENFORCE(this->in_bitnum_ < 64);

The restrictions should be this->in_bitnum_ > log2(alpha) and this->in_bitnum_ <= 64.
(3) In dpf.cc, // namespace flcrypto seems strange.
In // if enable_evalall, we have only one last_cw_vec, enable_evalall should be ! enable_evalall .
(4) The recursive way of Traverse function is different from the original paper. I think the implementation of Yacl is right and there is something wrong in the original paper.

Neither F2 - F1 = F nor F2 + F1 = F.

Can you show use your test case?

YACL_ENFORCE(this->in_bitnum_ > log(alpha));
YACL_ENFORCE(this->in_bitnum_ < 64);

Good Catch for (2) and (3), would you like to propose PR to fix those?

The recursive way of Traverse function is different from the original paper. I think the implementation of Yacl is right and there is something wrong in the original paper.

Yes, there are indeed some typos in the original paper, but the logics are the same.

For (1), the implementation is right. I mean the code annotation is wrong.
In the code annotation, F2(alpha) + F1(alpha) = 2r + beta.