Inferensys

Glossary

Garbled Circuits

A cryptographic protocol for secure two-party computation where a function is represented as a boolean circuit whose wires are encrypted, allowing evaluation without revealing the inputs.
Data scientist reviewing AI evaluation metrics on dashboard, comparison charts visible, casual WeWork analytics setup.
SECURE TWO-PARTY COMPUTATION

What is Garbled Circuits?

A foundational cryptographic protocol enabling two mutually distrusting parties to jointly evaluate a function over their private inputs without revealing those inputs to each other.

A garbled circuit is a cryptographic protocol for secure two-party computation (2PC) where a function is represented as a Boolean circuit. The circuit constructor "garbles" the circuit by encrypting the truth table of each logic gate using symmetric keys, creating a garbled truth table. The evaluator then obliviously computes the output by decrypting only the specific gate entries corresponding to the parties' private input wires, learning the final result but nothing about the constructor's input or the intermediate wire values.

The protocol relies on oblivious transfer (OT) to securely deliver the evaluator's input keys without revealing the input itself. While computationally intensive due to circuit-level encryption, optimizations like the free-XOR and half-gate techniques have made garbled circuits practical for privacy-preserving applications such as fraud detection across competing banks, secure auctions, and private set intersection, where raw transaction data must never be exposed.

CRYPTOGRAPHIC PRIMITIVES

Key Features of Garbled Circuits

Garbled circuits enable two mutually distrustful parties to jointly evaluate a function over their private inputs without revealing those inputs to each other. The protocol represents the function as a Boolean circuit, encrypts the wire values, and allows evaluation through a series of oblivious transfers.

01

Boolean Circuit Representation

The function to be computed is first compiled into a Boolean circuit consisting of logic gates (AND, XOR, NOT) and wires. This circuit representation is fundamental because garbled circuits operate at the gate level, encrypting the truth table of each gate. The garbler constructs this circuit and assigns two random cryptographic labels to each wire—one representing logical 0 and one representing logical 1—ensuring that the evaluator learns only the output label without discovering the underlying plaintext value.

02

Garbled Gate Construction

Each logic gate in the circuit is garbled by encrypting its output wire labels using the input wire labels as encryption keys. For a 2-input gate, the garbler creates four ciphertexts—one for each possible input combination—encrypting the corresponding output label. The resulting garbled table is randomly permuted so the evaluator cannot determine which ciphertext corresponds to which input combination. Only by possessing the correct input labels can the evaluator decrypt exactly one entry and obtain the correct output label.

03

Oblivious Transfer for Input Delivery

The evaluator obtains the wire labels corresponding to their private input through Oblivious Transfer (OT). In each OT instance, the garbler holds two labels (for 0 and 1), and the evaluator selects one based on their actual input bit. The garbler learns nothing about which label was selected, and the evaluator learns only the label for their chosen bit. This cryptographic primitive ensures that the evaluator's input remains private while providing exactly the labels needed to evaluate the circuit.

04

Point-and-Permute Optimization

The point-and-permute technique dramatically reduces evaluation cost by appending a random color bit to each wire label. The garbler uses these color bits to sort the garbled table, allowing the evaluator to identify which ciphertext to decrypt by simply observing the color bits of their input labels. This eliminates the need to trial-decrypt all four ciphertexts per gate, reducing the evaluator's work from four decryptions to a single decryption per gate while maintaining security.

05

Free-XOR Technique

The Free-XOR optimization eliminates cryptographic operations for XOR gates entirely. By choosing wire labels such that the XOR of two input labels equals the output label—specifically, setting label pairs with a fixed global offset Δ—XOR gates can be evaluated by simply XORing the input labels together. Since XOR gates often constitute a large fraction of Boolean circuits, this technique yields substantial performance improvements, making garbled circuits practical for complex functions.

06

Half-Gates Construction

The half-gates technique reduces the size of garbled AND gates from four ciphertexts to just two, cutting communication overhead nearly in half. It decomposes each AND gate into two half-gates—one where the garbler knows one input and one where the evaluator knows one input—and combines them using a free-XOR operation. Combined with Free-XOR, this optimization makes the entire garbled circuit protocol remarkably efficient, with AND gates requiring only two ciphertexts and XOR gates requiring none.

GARBLED CIRCUITS EXPLAINED

Frequently Asked Questions

Clear, technical answers to the most common questions about Yao's Garbled Circuits, their role in secure multi-party computation, and their application in privacy-preserving fraud analytics.

A garbled circuit is a cryptographic protocol for secure two-party computation (2PC) that allows two mutually distrusting parties to jointly evaluate any Boolean function over their private inputs without revealing those inputs to each other. The protocol works by having one party, the garbler, construct an encrypted version of a Boolean circuit representing the function. Each wire in the circuit is assigned two random cryptographic labels representing logical 0 and 1. Each logic gate is then replaced with a garbled truth table—a set of four ciphertexts encrypting the appropriate output label under the corresponding input labels. The second party, the evaluator, receives the garbled circuit and uses oblivious transfer (OT) to obtain the labels corresponding to its own private input bits without the garbler learning which labels were selected. The evaluator then processes the circuit gate-by-gate, decrypting exactly one entry per gate to obtain the output label, which is finally mapped back to a plaintext result. The fundamental security property is that the evaluator learns nothing about the garbler's input beyond what is logically revealed by the function's output, and the garbler learns nothing about the evaluator's input whatsoever.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.