Minisketch uses finite field arithmetic over $GF(2^b)$ to map data entries to field elements. The process follows these mathematical steps:
1. Mapping Data to Field Elements
Every integer in the range $[1...2^b-1]$ is mapped to a nonzero field element of $GF(2^b)$. Addition in this field corresponds to bitwise XOR.
2. Representing Sets as Power Series
Sets are treated as formal power series $S(M)$. For a set $M = {m_1, m_2, \dots}$, the series is the sum of individual element series: $S(M) = \sum S(m_i)$. Because field addition is XOR, $S(a) + S(a) = 0$, which enables the symmetric difference property.
3. Sketch Construction
A sketch is constructed using the first $2n$ coefficients of the power series $S(M)$. Specifically, the sketch is the list of sums of powers: $[m_1 + m_2 + \dots, m_1^2 + m_2^2 + \dots, \dots, m_1^{2n} + m_2^{2n} + \dots]$.
4. Element Recovery (Decoding)
To recover elements from a sketch of size $n$:
- Solve for Polynomial $L$: Use the coefficients of the sketch to set up $n$ linear equations. These equations are solved (typically via Gaussian elimination or the Berlekamp-Massey algorithm) to find the coefficients $l_i$ of a polynomial $L$.
- Find Roots: Find the roots of $L$.
- Invert Roots: The set elements $m_i$ are the inverses of the roots of $L$. To avoid expensive inversion operations, one can instead factor the polynomial $L$ with its coefficients in reverse order.
5. Handling Unknown Set Sizes
If the exact number of elements $n$ is unknown but an upper bound (capacity $c$) is provided, the Peterson-Gorenstein-Zierler algorithm is used. This involves attempting to solve the equations by counting down from $c$ until a valid solution is found.