"매 N parties 가 jointly compute f(x1, ..., xN) without revealing inputs". Yao 1982 garbled circuits → BGW 1988 secret sharing → modern SPDZ, ABY3, CrypTen for privacy-preserving ML. 매 2026 production: Apple PCC (Private Cloud Compute), Meta CrypTen, Google federated analytics.
매 핵심
매 Primitives
Secret sharing (Shamir): 매 split secret into N shares, t+1 reconstruct.
Garbled circuits (Yao): 매 2-party Boolean circuit evaluation.
Homomorphic encryption (FHE/PHE): 매 compute on ciphertext.
Oblivious Transfer (OT): 매 sender sends 1 of 2, receiver picks without revealing.
매 Threat models
Semi-honest (passive): 매 follow protocol but try to learn.
Malicious (active): 매 deviate arbitrarily — 매 needs MAC/zero-knowledge.
Covert: 매 cheat detected with high probability.
매 Modern frameworks
CrypTen (Meta): PyTorch-style MPC for ML.
MP-SPDZ: 매 wide protocol library.
TF-Encrypted: TensorFlow MPC.
Concrete (Zama): TFHE for ML inference.
매 응용
Privacy-preserving ML inference (medical, financial).
importcryptenimporttorchcrypten.init()# Two parties: server has model, client has input@crypten.mpc.run_multiprocess(world_size=2)defprivate_inference():model=crypten.nn.from_pytorch(my_model,dummy_input)model.encrypt(src=0)# server holds modelx_enc=crypten.cryptensor(client_input,src=1)# client inputy_enc=model(x_enc)y=y_enc.get_plain_text()# decrypt resultreturnyprivate_inference()
Secure aggregation (federated learning)
defsecure_aggregate(client_updates,threshold):# Each client masks update with random pad shared via DHn=len(client_updates)masks=[generate_pairwise_masks(i,n)foriinrange(n)]masked=[u+sum(masks[i])fori,uinenumerate(client_updates)]# Server sums — masks 매 cancel outreturnsum(masked)# 매 individual updates 매 hidden
Garbled circuit (Yao 2PC)
defgarble_AND():# 매 circuit: z = x AND ykeys={(b1,b2):random.randbytes(16)forb1in[0,1]forb2in[0,1]}output_keys={0:random.randbytes(16),1:random.randbytes(16)}table=[]for(b1,b2),k_ininkeys.items():z=b1&b2ct=aes_encrypt(k_in,output_keys[z])table.append(ct)random.shuffle(table)returntable,output_keys
defpsi_dh(a_set,b_set):# Diffie-Hellman based PSIa_secret,b_secret=random_scalar(),random_scalar()A_blinded=[hash_to_curve(x)**a_secretforxina_set]B_blinded=[hash_to_curve(y)**b_secretforyinb_set]A_double=[p**b_secretforpinA_blinded]B_double=[p**a_secretforpinB_blinded]returnset(A_double)&set(B_double)
매 결정 기준
상황
Approach
2-party ML inference
매 Garbled circuits 또는 CrypTen
N-party aggregation
매 Secret sharing (BGW, SPDZ)
Single ciphertext compute
매 FHE (Concrete, Microsoft SEAL)
Trusted hardware available
매 TEE (SGX, Apple PCC) — 매 fastest
Production LLM privacy
매 Apple PCC pattern (TEE + attestation)
기본값: 매 ML inference 면 CrypTen (semi-honest 2PC), 매 production privacy LLM 면 TEE-based (Apple PCC).
언제: 매 multi-party data joint analysis, 매 client-side model with private data, 매 medical/financial cross-org compute.
언제 X: 매 single-party compute (DP 면 충분), 매 latency-critical (MPC 매 100-1000× slower).
❌ 안티패턴
Semi-honest in production: 매 malicious adversary 가능 면 fail.
MPC for everything: 매 100× overhead — TEE 가 better when available.
Naive secret sharing: 매 multiplication 매 expensive (Beaver triples 필요).
Ignoring side-channels: 매 timing/power leak — 매 protocol-only 매 부족.