pls works
This commit is contained in:
parent
43f28695d0
commit
e4ec6b421e
|
@ -47,7 +47,7 @@ public class balancedBlockClient {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int impBlock = index % this.sqrtSize;
|
int impBlock = (int) Math.floor(index/this.sqrtSize);
|
||||||
System.out.println("ImpBlock: " + impBlock);
|
System.out.println("ImpBlock: " + impBlock);
|
||||||
if (S1[index % this.sqrtSize] == 1) {
|
if (S1[index % this.sqrtSize] == 1) {
|
||||||
S2[index % this.sqrtSize] = 0; // Remove the index, if it's contained in S.
|
S2[index % this.sqrtSize] = 0; // Remove the index, if it's contained in S.
|
||||||
|
@ -62,6 +62,8 @@ public class balancedBlockClient {
|
||||||
int[] resBit1 = this.servers[0].computeBit(S1);
|
int[] resBit1 = this.servers[0].computeBit(S1);
|
||||||
int[] resBit2 = this.servers[1].computeBit(S2);
|
int[] resBit2 = this.servers[1].computeBit(S2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ((resBit1[impBlock] + resBit2[impBlock]) % 2);
|
return ((resBit1[impBlock] + resBit2[impBlock]) % 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,13 +72,13 @@ public class balancedBlockClient {
|
||||||
PIRSettings settings = new PIRSettings(16, 2, 1);
|
PIRSettings settings = new PIRSettings(16, 2, 1);
|
||||||
balancedBlockServer[] servers = new balancedBlockServer[settings.getNumServers()];
|
balancedBlockServer[] servers = new balancedBlockServer[settings.getNumServers()];
|
||||||
|
|
||||||
Database database = new MemoryDatabase(settings, new int[] {0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0});
|
Database database = new MemoryDatabase(settings, new int[] {0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0});
|
||||||
|
|
||||||
for (int i = 0; i < settings.getNumServers(); i++) {
|
for (int i = 0; i < settings.getNumServers(); i++) {
|
||||||
servers[i] = new balancedBlockServer(database, settings);
|
servers[i] = new balancedBlockServer(database, settings);
|
||||||
}
|
}
|
||||||
balancedBlockClient client = new balancedBlockClient(settings, servers, null);
|
balancedBlockClient client = new balancedBlockClient(settings, servers, null);
|
||||||
System.out.println(client.receiveBit(6));
|
System.out.println(client.receiveBit(11));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class balancedBlockServer {
|
||||||
try {
|
try {
|
||||||
boolean test = indexes[j] == 1;
|
boolean test = indexes[j] == 1;
|
||||||
if (test) {
|
if (test) {
|
||||||
|
System.out.println("Looking at index: " + (j + (this.sqrtSize * i)));
|
||||||
tmpRes = (tmpRes + db[j + (this.sqrtSize * i)]) % 2;
|
tmpRes = (tmpRes + db[j + (this.sqrtSize * i)]) % 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue