fixed bug. Still broken. Sadface.

This commit is contained in:
Alexander Munch-Hansen 2019-11-11 00:52:25 +01:00
parent a1d1a0a16c
commit 16144aa9bd
2 changed files with 6 additions and 4 deletions

View File

@ -41,8 +41,9 @@ public class Driver {
public static void generalInterPolyTest() {
ProtocolUtils utils = new ProtocolUtils();
GeneralInterPolyClient client = new GeneralInterPolyClient(22);
int s = utils.findSizeOfS(2, PIRSettings.DATABASE_SIZE);
GeneralInterPolyClient client = new GeneralInterPolyClient(22, s);
int[] database = new int[PIRSettings.DATABASE_SIZE];
GeneralInterPolyServer[] servers = new GeneralInterPolyServer[PIRSettings.MOD_BIT_LENGTH + 1];

View File

@ -16,10 +16,11 @@ public class GeneralInterPolyClient {
private BigIntegerField field;
private FieldElement[] fieldElements = new FieldElement[PIRSettings.MOD_BIT_LENGTH];
private FieldElement[] fieldElements;
public GeneralInterPolyClient(int i) {
public GeneralInterPolyClient(int i, int s) {
this.i = i;
fieldElements = new FieldElement[s];
this.field = new BigIntegerField();
}
@ -29,7 +30,7 @@ public class GeneralInterPolyClient {
}
}
public BigInteger g(int l, int z) {
private BigInteger g(int l, int z) {
BigInteger il = BigInteger.valueOf(IntegerUtils.leastSignificantBit(i, l)).mod(field.getGroupOrder());
return field.add(field.multiply(fieldElements[l].getValue(), (BigInteger.valueOf(z))), il);
}