Garbled binary-to-one-hot conversion #
The binary-to-one-hot conversion bin-to-hot of Heath [Hea24] (§4, pp. 13–14; the
construction is in §4.1, p. 14). The lookup-table garbling scheme logrow of Heath, Kolesnikov
and Ng [HKN24] uses one-hot garbling through the interface of its Figure 1
(p. 10). Wire labels live in an additive group L of characteristic two (over GF(2)^λ, addition
is XOR) with a Free-XOR global offset Δ [KS08]: the label of bit b on a
wire with zero-label X is X + bitOffset Δ b. From one label on each of n + 1 input wires
and n ciphertexts of one label each, the evaluator obtains Free-XOR labels of the one-hot vector
of its input, a vector of 2 ^ (n + 1) bits.
One-hot garbling is due to Heath and Kolesnikov [HK21]. Their conversion (§4.1,
p. 10 of the ePrint full version) expands a GGM tree and sends two encrypted values per level and a
final correction, 2(n - 1) + 1 ciphertexts for n input bits. The single-ciphertext step used
here is Heath's, which [Hea24], §4, notes halves that material to (n - 1) κ bits. With the
paper's n equal to n + 1 here, this is the (n - 1) κ term of the logrow material size
([HKN24], Theorem 1, p. 19, and the cost breakdown on p. 20). Figure 1 of
[HKN24] instead states (2n - 1) κ bits for the one-hot interface, the count of
[HK21]; the gadget here matches Theorem 1, not Figure 1.
Positions of the one-hot vector over t + 1 input bits are bit vectors j : Fin (t + 1) → Bool;
the position Fin.snoc j c of the next vector extends j by the next input bit c. Over one
input bit, the zero-labels are X at position true and X + Δ at position false, and the
evaluator holding the label X + bitOffset Δ x₀ uses it at both positions; no ciphertext is
needed. A doubling step (garbleStep) hashes each zero-label G j to y j, keeps G j + y j
at position Fin.snoc j false and y j at Fin.snoc j true, and sends the ciphertext
b + ∑ j, y j, where b is the zero-label of the new input bit. The evaluator (evalStep)
knows the hot position x but not the zero-label at x. It recomputes y j at every other
position, and recovers y x + bitOffset Δ c from its label b + bitOffset Δ c of the new bit
and the ciphertext.
In the notation of [Hea24], §4.1, a step scales the one-hot vector h of the bits so far by
the new bit (scale₁, which needs no material), joins the sum s of the scaled vector h′ with
the new bit, and returns (h′ + h) ⊔ h′. Here y j is the zero-label of h′ at position j,
the ciphertext is that one join, and G j + y j and y j are the zero-labels of the halves
h′ + h and h′. [Hea24] recurses on x[1..] and joins x[0]; this file appends the new
bit last.
Hashes are a tweakable function H : L → T → L; step t hashes position j with tweak tw t j.
Correctness (evaluate_garble) holds for every H, tw, Δ, choice of zero-labels and
input. In logrow the evaluator's index is the input masked by the garbler's permutation bits,
which it reads from its labels; this file takes that index as given. Combined with the
truth-table product, the evaluator obtains Free-XOR labels of the row of any public table at its
index (tableMul_evaluate_garble). The per-instance CCR reduction step for obliviousness is in
CslibFrontier.Crypto.Primitives.Garbling.BinaryToOneHotObliviousness.
Main definitions #
Cslib.Crypto.Garbling.BinaryToOneHot.garbleStep,.evalStep: one doubling step.Cslib.Crypto.Garbling.BinaryToOneHot.garble: zero-labels of the one-hot vector and thenciphertexts, from the zero-labels ofn + 1input wires.Cslib.Crypto.Garbling.BinaryToOneHot.evaluate: the evaluator.
Main results #
Cslib.Crypto.Garbling.BinaryToOneHot.evalStep_garbleStep: one step preserves one-hot labels.Cslib.Crypto.Garbling.BinaryToOneHot.evaluate_garble: correctness.Cslib.Crypto.Garbling.BinaryToOneHot.tableMul_evaluate_garble: labels of a selected row.
References #
One doubling step of the garbler, from t + 1 to t + 2 input bits. h j hashes the
zero-label of position j, b is the zero-label of the new input bit and G the current
zero-labels. Returns the new zero-labels and the step's ciphertext b + ∑ j, h j (G j).
One doubling step of the evaluator, who knows the hot position x, holds the label a of the
new input bit and the current labels E, and receives the ciphertext ct. It hashes every label
but the one at x, and recovers the hash at x, masked by the new bit, from a and ct.
The garbler with global offset Δ, from the zero-labels X of n + 1 input wires: the
zero-labels of the one-hot vector and one ciphertext for each of the n doubling steps.
The evaluator, from the index x, one label A on each input wire and the ciphertexts ct:
its labels of the one-hot vector.
One doubling step is correct: if the evaluator holds the labels of the one-hot vector of
x with zero-labels G and the label of bit c of the new input wire, it obtains the labels of
the one-hot vector of Fin.snoc x c with the new zero-labels.
Correctness: on the labels of its input bits and the garbled ciphertexts, the evaluator obtains the labels of the one-hot vector of its input, for every hash, tweaks, offset and zero-labels.
Labels of a selected row. With the labels the evaluator obtains, the product with any
public table T gives, at each output u, the label of bit T x u with zero-label
tableMul T G u, where G are the garbler's one-hot zero-labels.