Secure Multi-Party Computation
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
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
}
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 |
package main
func main(a, b int) (int, int) {
q, r := a / b
return q, r
}
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 |