Commit e229081f authored by Thomas Hoffmann's avatar Thomas Hoffmann
Browse files

fix bugs - working version

parent 1da78dfa
......@@ -132,10 +132,10 @@ func (P *Protocol) AND(xwire, ywire int) int {
var idx_w, _ = A.Receive(), B.Receive()
//2 compute [d] = [x] XOR [u]
var idx_d1, _ = A.XOR2W(xwire, idx_u), B.XOR2W(xwire, idx_u)
var idx_d1 = P.XOR2W(xwire,idx_u)//A.XOR2W(xwire, idx_u), B.XOR2W(xwire, idx_u)
//3. compute [e] = [y] XOR [v]
var idx_e1, _ = A.XOR2W(ywire, idx_v), B.XOR2W(ywire, idx_v)
var idx_e1 = P.XOR2W(ywire,idx_v)//A.XOR2W(ywire, idx_v), B.XOR2W(ywire, idx_v)
//4. Open d
A.Send(idx_d1)
......@@ -148,8 +148,8 @@ func (P *Protocol) AND(xwire, ywire int) int {
var idx_e2, _ = A.Receive(), B.Receive()
//6a. Compute d and e
var idx_d, _ = A.XOR2W(idx_d1, idx_d2), B.XOR2W(idx_d1, idx_d2)
var idx_e, _ = A.XOR2W(idx_e1, idx_e2), B.XOR2W(idx_e1, idx_e2)
var idx_d = P.XOR2W(idx_d1,idx_d2)//A.XOR2W(idx_d1, idx_d2), B.XOR2W(idx_d1, idx_d2)
var idx_e = P.XOR2W(idx_e1,idx_e2)//A.XOR2W(idx_e1, idx_e2), B.XOR2W(idx_e1, idx_e2)
//6b. Compute [z]-parts
var idx_z1, _ = A.ANDC(xwire, A.stack[idx_e]), B.ANDC(xwire, B.stack[idx_e])
......@@ -159,7 +159,7 @@ func (P *Protocol) AND(xwire, ywire int) int {
//6c. Compute [z]
var idx_z4, _ = A.XOR2W(idx_w, idx_z1), B.XOR2W(idx_w, idx_z1)
var idx_z5, _ = A.XOR2W(idx_z4, idx_z2), B.XOR2W(idx_z4, idx_z2)
var idx_z, _ = A.XOR2W(idx_z5, idx_z3), B.XOR2W(idx_z5, idx_z3)
var idx_z, _ = A.XORC(idx_z5, A.stack[idx_z3], true), B.XORC(idx_z5, B.stack[idx_z3],false)
return idx_z
}
......
......@@ -293,7 +293,7 @@ func TestProtocol(t *testing.T) {
for x := 0; x < n; x++ {
for y := 0; y < n; y++ {
if z := RunProtocol(x, y); z != BloodTable[x][y] {
t.Fatalf("Failed blood compatibility test for index [%d,%d]. Expected %t, got %t", x, y, !z, z)
t.Errorf("Failed blood compatibility test for index [%d,%d]. Expected %t, got %t", x, y, !z, z)
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment