Skip to content

Secure Multi-Party Computation (MPC) with Go. This project implements secure two-party computation with Garbled circuit protocol.

License

Notifications You must be signed in to change notification settings

markkurossi/mpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mpc

Secure Multi-Party Computation

SSA (Static single assignment form)

package main

func main(a, b int) int {
    if a > b {
        return a
    }
    return b
}

The compiler creates the following SSA form assembly:

l0:
	igt    a{1,0}i b{1,0}i %_{0,0}b
	jump   l2
l2:
	if     %_{0,0}b l3
	jump   l4
l4:
	mov    b{1,0}i %ret0{1,2}i
	jump   l1
l1:
	phi    %_{0,0}b %ret0{1,1}i %ret0{1,2}i %_{0,1}i
	ret    %_{0,1}i
l3:
	mov    a{1,0}i %ret0{1,1}i
	jump   l1

Circuit generation

The SSA form assembly is converted into logic gate circuit. The following circuit was generated from the following 4-bit max MPCL code:

package main

func main(a, b int4) int4 {
    if a > b {
        return a
    }
    return b
}

Syntax

Types

Name Size Signed Alias
bool 1 no
byte 8 no uint8
uint 32 no uint32
int 32 yes int32
uintN N no
intN N yes
floatN N yes

Mathematical operations

package main

func main(a, b int) (int, int) {
    q, r := a / b
    return q, r
}

Building blocks

MUX

O=(D0 XOR D1)C XOR D0
D0 D1 C D0 XOR D1 AND C XOR D0
0 0 0 0 0 0
0 1 0 1 0 0
1 0 0 1 0 1
1 1 0 0 0 1
0 0 1 0 0 0
0 1 1 1 1 1
1 0 1 1 1 0
1 1 1 0 0 1