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

2-party DCF scheme. More...

Classes

struct  Cw
 Correction word. More...
 

Public Member Functions

void Gen (Cw cws[], const int4 s0s[2], In a, int4 b_buf)
 Key generation method.
 
int4 Eval (bool b, int4 s0, const Cw cws[], In x)
 Evaluation method.
 
void EvalAll (bool b, int4 s0, const Cw cws[], int4 ys[])
 Full domain evaluation method.
 

Public Attributes

Prg prg
 

Detailed Description

template<int in_bits, typename Group, typename Prg, typename In = uint, DcfPred pred = DcfPred::kLt, 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, 4>)
class fss::Dcf< in_bits, Group, Prg, In, pred, par_depth >

2-party DCF scheme.

Template Parameters
in_bitsInput domain bit size.
GroupType for the output domain. See Groupable.
PrgSee Prgable.
InType for the input domain. From uint8_t to __uint128_t.
predSee DcfPred.
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 In = uint, DcfPred pred = DcfPred::kLt, int par_depth = -1>
int4 fss::Dcf< in_bits, Group, Prg, In, pred, par_depth >::Eval ( bool  b,
int4  s0,
const Cw  cws[],
In  x 
)
inline

Evaluation method.

Parameters
bParty index. False for 0 and true for 1. \(i\).
s0Initial seed of the party.
cwsReturned by Gen().
xEvaluated input. \(x\).
Returns
Output share. \(y_{i,x}\).

◆ EvalAll()

template<int in_bits, typename Group , typename Prg , typename In = uint, DcfPred pred = DcfPred::kLt, int par_depth = -1>
void fss::Dcf< in_bits, Group, Prg, In, pred, par_depth >::EvalAll ( bool  b,
int4  s0,
const Cw  cws[],
int4  ys[] 
)
inline

Full domain evaluation method.

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

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

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

Support parallel using OpenMP. 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 In = uint, DcfPred pred = DcfPred::kLt, int par_depth = -1>
void fss::Dcf< in_bits, Group, Prg, In, pred, par_depth >::Gen ( Cw  cws[],
const int4  s0s[2],
In  a,
int4  b_buf 
)
inline

Key generation method.

Parameters
cwsPre-allocated array of Cw as returns. The array size must be in_bits + 1.
s0s2 initial seeds. Users can randomly sample them.
a\(a\).
b_buf\(b\). Will be clamped and converted to the group element.

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


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