\(q1\) and \(q4\) can be computed locally. \(q2,q3\) ?
Beaver triplets
Imagine an imaginary party choosing uniformly at random \(a, b\) and \(c\) such that \(a\cdot b = c\) and additively secret shares all values \([a],[b]\) and \([c]\) with \(A\) and \(B\).
A and B compute locally: \(d=[v1]-[a]\) and \(e=[v2]-[b]\) and reveal \(e\) and \(d\) which are perfectly hiding \(v1\) and \(v2\).
Find the first position \(p\) where the numbers start to differ starting from the most significant part (leftmost part)
Extract from both numbers their bit at position \(p\)
if \(b[p]==0\) then \(a<b\)
Bitwise Arithmetics
Compute bitwise XOR of \(a\) and \(b\) and store it to \(c\). That will result in a bit vector where at \(0\) positions \(a\) and \(b\) are equal and at \(1\) positions they differ.
Compute the OR of each bit of \(c\) starting from the leftmost bit and store it to \(d\). \(d[l-1]=c[l-1],\\
d[l-2]= d[l-1] \lor c[l-2]\),… That results in a bit vector of \(0\)'s followed with \(1\)'s starting at the position where \(a\) and \(b\) started to differ from leftmost.
Perform component wise subtraction at vector \(d\) starting leftmost as in the previous step and store it in \(e\). That will result in a bit vector with only a single \(1\) at the position where \(a\) and \(b\) started to differ from leftmost.
Inner product of \(b\) with \(e\). \(e\) is a one bit vector so that operation extracts the bit value of \(b\) in that positions where \(e[i]=1\)
Fifth step: \(r= \sum{f[i]} =1\) so output 1, meaning \(a<b\), which is true: \(2<4\)
From numbers to bits
Instead addition secret sharing perform xoring
\([x1]xor[x2] = x\)
XOR comes for free (Additions in the ring)
NOT comes for free (flip bits)
AND needs beaver triplets (multiplication)
BitDecomposition
Input: Each \(CP_i\) holds a share \([x]_M\) of \(x\) Output: Each \(CP_i\) holds a share \([x]_2\) of bit \(x\) \([a]_i^j\): secret share of the \(i\)th bit of \(x\) held by party \(j\)
Each CP secret shares a \(l\) random bit \(r_i\) with all other parties such that no one knows \(r=\sum{r_i2^i}\)