Skip to content

SPDZ Forge

Malicious-secure arithmetic MPC · Beaver triples · MACs

Three parties multiply secret-shared numbers they cannot see — and when you, playing one of them, lie about your share, the arithmetic itself catches it.

What is this?

Secure multi-party computation (MPC) lets several parties compute an answer from inputs they keep secret from each other. Most classroom MPC — Shamir sharing, Yao's garbled circuits — assumes every party follows the protocol and merely tries to peek. SPDZ (Damgård–Pastro–Smart–Zakarias, 2012) drops that assumption: every secret share carries a tiny algebraic tag (a MAC) under a key nobody holds, so a party who submits a wrong share produces a tag that doesn't check out — and the honest parties abort rather than accept a wrong answer.

Everything on this page is real arithmetic in the prime field Fp with p = 2⁶¹ − 1, running in your browser. Every share is inspectable. This is a teaching demo, not production crypto: the three "parties" are one JavaScript page, and the preprocessing dealer is trusted (both stated where they matter below).

New to the jargon? Three terms carry this whole page

Secret sharing: splitting a number x into random-looking pieces ("shares") that only reveal x when combined. Here, three shares that sum to x mod p.
Semi-honest ("honest-but-curious"): a security model where corrupted parties follow the protocol but analyze everything they see, hoping to learn secrets.
Malicious: a model where corrupted parties can deviate arbitrarily — send wrong values, lie about results. SPDZ is secure here, even if all but one party cheats (dishonest majority): the honest party keeps its privacy, and cheating on correctness is detected with overwhelming probability.

STEP 1 · THE FREE PART

Addition is free

Shares of x plus shares of y are shares of x + y — each party just adds the two numbers it already holds. No messages, no cost, done.

STEP 2 · HEADLINE MECHANISM

Multiplication needs a trick: the Beaver triple

x·y is a product of two numbers nobody knows — no local sum produces it. The fix is bought in advance: a preprocessed random triple (a, b, c) with c = a·b, dealt as shares. Step through a real multiplication and watch what crosses the wire.

STEP 3 · THE REASON THIS LAB EXISTS

Cheat, and let the MAC check catch you

Every share travels with a share of α·x — an information-theoretic MAC under the global key α that no party holds. Play the malicious party: edit your share, open the value in both protocols, and compare what each one does about it.

RESEARCH EXTENSION · KEY CONSISTENCY

When abort becomes a privacy oracle

A valid SPDZ session uses one reconstructed global MAC key even though every party holds a different additive share of it. Off-Key asks what happens when an implementation mixes an input authenticated under one reconstructed key with preprocessing authenticated under another. Run the same attacker request against a key-bound context and a deliberately shifted context; the displayed residuals, accept/abort decisions, and deductions all come from the authenticated-share arithmetic.

RESEARCH EXTENSION · DEPENDENT CHECKS

Can an abort come too late?

A different MPC family checks redundant messages after several dependent gates. Run an isolated synthetic trace: an incorrect first-gate message changes an honest party's state, and a later per-party hash can reveal a masked input before the final abort. Compare an immediate check and a joint delayed verdict. This is not SPDZ's MAC-check protocol. Brüggemann and Schneider, EUROCRYPT 2026, §3.3 and §3.5.

RESEARCH EXTENSION · CONCURRENT CHECKS

The MAC key that leaked through a rushing check

Step 3 says nobody holds α. That is true of the protocol, and it has been false of implementations. When a MAC check fails, the check shares the honest parties open add up to a multiple of α — and a corrupt party who opens last can read it off, keep its own opening back so that the check never formally fails, and spend the key in a second check that is still running. Run the two checks at once, then one at a time, then with the masked check that removes the leak. Source: Kyster, Huss Nielsen, Oechsner and Scholl, Rushing at SPDZ: On the Practical Security of Malicious MPC Implementations, §3.1–3.2 and §5.

STEP 4 · THE ARCHITECTURE

Offline vs online: why SPDZ is deployable

STEP 5 · A REAL COMPUTATION

Three hospitals compute a variance

For the cryptographers

Research update — October 19, 2026: keep one MAC key.

All shares and preprocessing used together must be authenticated under the same global MAC key. Keller, Navot and Tyagi, Off-Key (ePrint 2026/2533), a preprint, reports privacy attacks when evaluated implementations violate this requirement across batches, threads or process runs. Depending on the check, a corrupt party can recover a shared secret or test guesses through selective failure. This is an implementation condition, not a break of SPDZ's theoretical guarantees.

This demo's main SPDZ path uses one in-memory MAC key for inputs and every triple-bank refill. The research extension above deliberately constructs a separate β = α + Δ context in a bounded three-party trusted-dealer model, so the paper's residuals and attacker-visible outcomes can be checked. It does not reproduce the evaluated frameworks, distributed preprocessing, cross-process state, or their implementation vulnerabilities.

The exact construction on this page

Field: Fp, p = 2⁶¹ − 1 (Mersenne; the same field MP-SPDZ's Mersenne61 backend uses), BigInt arithmetic, uniform sampling by rejection from the platform CSPRNG. Sharing: x ↦ (x₀, x₁, x₂) additive, with γ(x)ᵢ additive shares of α·x; α itself additively shared at setup. The MAC check on an opened y computes σᵢ = γ(y)ᵢ − αᵢ·y and requires Σσᵢ = 0. Multiplication is Beaver's: open d = x − a, e = y − b, set [z] = [c] + d·[b] + e·[a] + d·e, with MACs carried through the same linear map. The addition panel directly reconstructs its sum. The ordinary Beaver and variance paths check MAC residues locally, including the masked openings d and e. A separate MAC exhibit models the order of a distributed exchange using SHA-256 commitments over random nonces.

In the simplified single-value field calculation, fix a nonzero change to the opened value and fix the claimed MAC change independently of a hidden, uniformly sampled key α. Exactly one key in Fp makes the residue zero, giving probability 1/p ≈ 4.3×10⁻¹⁹ under those assumptions. Published batched MAC checks have their own bounds and protocol assumptions.

Modeled/simplified relative to the paper: triples (and all shares) come from a trusted dealer — no SHE/ZK offline phase. The locally authenticated paths check individual values. Published online protocols can check a batch using random coefficients. All three parties run in one browser tab.

Threat-model matrix: what this lab does vs a real SPDZ deployment
Primary sources

What this isn't

Not a garbled-circuits lab — Yao is two-party boolean; this is n-party arithmetic (see garbled-gate). Not a Shamir lab — polynomial sharing with an honest majority lives in shamir-gate and silent-tally. Not an oblivious-transfer lab (ot-gate). It does not build triple generation (SHE or MASCOT/Overdrive) — triples are dealt by a trusted dealer here — and it does not build identifiable abort: when SPDZ aborts, you learn that someone cheated, not who.