1
0
Fork 0

pls works

This commit is contained in:
Alexander Munch-Hansen 2019-12-05 17:12:38 +01:00
parent 43f28695d0
commit e4ec6b421e
2 changed files with 6 additions and 3 deletions

View file

@ -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);
if (S1[index % this.sqrtSize] == 1) {
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[] resBit2 = this.servers[1].computeBit(S2);
return ((resBit1[impBlock] + resBit2[impBlock]) % 2);
}
@ -70,13 +72,13 @@ public class balancedBlockClient {
PIRSettings settings = new PIRSettings(16, 2, 1);
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++) {
servers[i] = new balancedBlockServer(database, settings);
}
balancedBlockClient client = new balancedBlockClient(settings, servers, null);
System.out.println(client.receiveBit(6));
System.out.println(client.receiveBit(11));
}
}

View file

@ -37,6 +37,7 @@ public class balancedBlockServer {
try {
boolean test = indexes[j] == 1;
if (test) {
System.out.println("Looking at index: " + (j + (this.sqrtSize * i)));
tmpRes = (tmpRes + db[j + (this.sqrtSize * i)]) % 2;
}