myl7/fss 1.1.0
Function secret sharing (FSS) primitives including distributed point/comparison function (DPF/DCF)
Loading...
Searching...
No Matches
fss::Vdpf< in_bits, Group, Prg, XorHash, Hash, In, par_depth > Class Template Reference

2-party VDPF scheme. More...

Classes

struct  Cw
 Correction word. More...
 

Public Member Functions

int Gen (Cw cws[], cuda::std::array< int4, 4 > &cs, int4 &ocw, cuda::std::span< const int4, 2 > s0s, In a, int4 b_buf)
 Key generation method.
 
cuda::std::array< int4, 4 > Eval (bool b, int4 s0, cuda::std::span< const Cw > cws, cuda::std::span< const int4, 4 > cs, int4 ocw, In x, int4 &y)
 Evaluation method.
 
void Prove (cuda::std::span< const cuda::std::array< int4, 4 > > pi_tildes, cuda::std::span< const int4, 4 > cs, cuda::std::array< int4, 4 > &pi)
 Proof accumulation method.
 
void EvalAll (bool b, int4 s0, cuda::std::span< const Cw > cws, cuda::std::span< const int4, 4 > cs, int4 ocw, cuda::std::span< int4 > ys, cuda::std::array< int4, 4 > &pi)
 Full domain evaluation method.
 

Static Public Member Functions

static bool Verify (cuda::std::span< const int4, 4 > pi0, cuda::std::span< const int4, 4 > pi1)
 Verification method.
 

Public Attributes

Prg prg
 
XorHash xor_hash
 
Hash hash
 

Detailed Description

template<int in_bits, typename Group, typename Prg, typename XorHash, typename Hash, typename In = uint, int par_depth = -1>
requires ((std::is_unsigned_v<In> || std::is_same_v<In, __uint128_t>) && in_bits <= sizeof(In) * 8 && Groupable<Group> && Prgable<Prg, 2> && XorHashable<XorHash> && Hashable<Hash>)
class fss::Vdpf< in_bits, Group, Prg, XorHash, Hash, In, par_depth >

2-party VDPF scheme.

Template Parameters
in_bitsInput domain bit size.
GroupType for the output domain. See Groupable.
PrgSee Prgable.
XorHashSee XorHashable. Paper's \(H\): maps \((x, s)\) to \(4\lambda\) bits.
HashSee Hashable. Paper's \(H'\): maps \(4\lambda\) bits to \(2\lambda\) bits.
InType for the input domain. From uint8_t to __uint128_t.
par_depth-1 is to use ceil(log(num of threads)), which should be good enough. Only EvalAll() uses it. See EvalAll() for details.

Member Function Documentation

◆ Eval()

template<int in_bits, typename Group , typename Prg , typename XorHash , typename Hash , typename In = uint, int par_depth = -1>
cuda::std::array< int4, 4 > fss::Vdpf< in_bits, Group, Prg, XorHash, Hash, In, par_depth >::Eval ( bool  b,
int4  s0,
cuda::std::span< const Cw cws,
cuda::std::span< const int4, 4 >  cs,
int4  ocw,
In  x,
int4 &  y 
)
inline

Evaluation method.

Parameters
bParty index. False for 0 and true for 1. \(i\).
s0Initial seed of the party.
cwsReturned by Gen(). Size must be in_bits.
csReturned by Gen().
ocwReturned by Gen().
xEvaluated input. \(x\).
yOutput share written here. \(y_{i,x}\).
Returns
Corrected per-point hash ( \(\correct(\tilde\pi, cs, t)\)) for proof accumulation.

◆ EvalAll()

template<int in_bits, typename Group , typename Prg , typename XorHash , typename Hash , typename In = uint, int par_depth = -1>
void fss::Vdpf< in_bits, Group, Prg, XorHash, Hash, In, par_depth >::EvalAll ( bool  b,
int4  s0,
cuda::std::span< const Cw cws,
cuda::std::span< const int4, 4 >  cs,
int4  ocw,
cuda::std::span< int4 >  ys,
cuda::std::array< int4, 4 > &  pi 
)
inline

Full domain evaluation method.

Evaluate the key on each input, i.e., 0b00...0 - 0b11...1. Store the outputs sequentially and accumulate the proof.

b, s0, cws, cs, ocw are the same as the ones in Eval().

Parameters
ysPre-allocated output array. Its size must be at least 2 ** in_bits.
piProof output.

Support parallel using OpenMP for the tree traversal phase. The task is divided to 2 ** par_depth parallel sub-tasks with the equal workloads. par_depth = -1: use ceil(log(num of threads)). par_depth = 0: no parallelism, i.e., sequential execution.

◆ Gen()

template<int in_bits, typename Group , typename Prg , typename XorHash , typename Hash , typename In = uint, int par_depth = -1>
int fss::Vdpf< in_bits, Group, Prg, XorHash, Hash, In, par_depth >::Gen ( Cw  cws[],
cuda::std::array< int4, 4 > &  cs,
int4 &  ocw,
cuda::std::span< const int4, 2 >  s0s,
In  a,
int4  b_buf 
)
inline

Key generation method.

Parameters
cwsPre-allocated array of Cw as returns. The array size must be in_bits.
csCorrection seed output ( \(4\lambda\) bits).
ocwOutput correction word output.
s0s2 initial seeds. Users can randomly sample them.
a\(a\).
b_buf\(b\). Will be clamped and converted to the group element.
Returns
0 on success, 1 if \(t_0 = t_1\) at the end (caller should resample seeds and retry).

The key for party i consists of cws + cs + ocw + s0s[i].

◆ Prove()

template<int in_bits, typename Group , typename Prg , typename XorHash , typename Hash , typename In = uint, int par_depth = -1>
void fss::Vdpf< in_bits, Group, Prg, XorHash, Hash, In, par_depth >::Prove ( cuda::std::span< const cuda::std::array< int4, 4 > >  pi_tildes,
cuda::std::span< const int4, 4 >  cs,
cuda::std::array< int4, 4 > &  pi 
)
inline

Proof accumulation method.

Accumulates corrected per-point hashes (from Eval()) into a single proof.

Parameters
pi_tildesCorrected per-point hashes returned by Eval().
csReturned by Gen().
piProof output.

◆ Verify()

template<int in_bits, typename Group , typename Prg , typename XorHash , typename Hash , typename In = uint, int par_depth = -1>
static bool fss::Vdpf< in_bits, Group, Prg, XorHash, Hash, In, par_depth >::Verify ( cuda::std::span< const int4, 4 >  pi0,
cuda::std::span< const int4, 4 >  pi1 
)
inlinestatic

Verification method.

Returns
True if proofs match (Accept), false otherwise (Reject).

The documentation for this class was generated from the following file: