diff --git a/pir/src/main/java/dk/au/pir/Driver.java b/pir/src/main/java/dk/au/pir/Driver.java index 248d98b..e0979fa 100644 --- a/pir/src/main/java/dk/au/pir/Driver.java +++ b/pir/src/main/java/dk/au/pir/Driver.java @@ -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]; diff --git a/pir/src/main/java/dk/au/pir/protocols/general/interpoly/GeneralInterPolyClient.java b/pir/src/main/java/dk/au/pir/protocols/general/interpoly/GeneralInterPolyClient.java index a5d335f..412e463 100644 --- a/pir/src/main/java/dk/au/pir/protocols/general/interpoly/GeneralInterPolyClient.java +++ b/pir/src/main/java/dk/au/pir/protocols/general/interpoly/GeneralInterPolyClient.java @@ -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); }