From 16144aa9bded25546a43a05a0bed5ad59e1b02f3 Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Mon, 11 Nov 2019 00:52:25 +0100 Subject: [PATCH] fixed bug. Still broken. Sadface. --- pir/src/main/java/dk/au/pir/Driver.java | 3 ++- .../general/interpoly/GeneralInterPolyClient.java | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) 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); }