From 0a8d4abe72d539de44c1fbfaa2e92e9761c62b99 Mon Sep 17 00:00:00 2001 From: "tzlil.gon" Date: Fri, 5 Feb 2016 13:36:55 +0200 Subject: [PATCH] sketch of JointFeldmanProtocol --- .../ShamirSecretSharing/SecretSharing.java | 7 +++++++ .../ShamirSecretSharing/SecretSharingTest.java | 4 ++-- .../VerifiableSecretSharingTest.java | 7 +++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/destributed-key-generation/src/main/java/FeldmanVerifiableSecretSharing/ShamirSecretSharing/SecretSharing.java b/destributed-key-generation/src/main/java/FeldmanVerifiableSecretSharing/ShamirSecretSharing/SecretSharing.java index 4a90ac7..0559a7c 100644 --- a/destributed-key-generation/src/main/java/FeldmanVerifiableSecretSharing/ShamirSecretSharing/SecretSharing.java +++ b/destributed-key-generation/src/main/java/FeldmanVerifiableSecretSharing/ShamirSecretSharing/SecretSharing.java @@ -58,6 +58,13 @@ public class SecretSharing { return new Polynomial.Point(BigInteger.valueOf(i), polynomial, q); } + /** + * use for test only + */ + public Polynomial.Point getShareForTest(int i){ + return getShare(i); + } + /** * @param shares - subset of the original shares * diff --git a/destributed-key-generation/src/test/java/FeldmanVerifiableSecretSharing/ShamirSecretSharing/SecretSharingTest.java b/destributed-key-generation/src/test/java/FeldmanVerifiableSecretSharing/ShamirSecretSharing/SecretSharingTest.java index d5f8842..bc96f7f 100644 --- a/destributed-key-generation/src/test/java/FeldmanVerifiableSecretSharing/ShamirSecretSharing/SecretSharingTest.java +++ b/destributed-key-generation/src/test/java/FeldmanVerifiableSecretSharing/ShamirSecretSharing/SecretSharingTest.java @@ -33,12 +33,12 @@ public class SecretSharingTest { secrets = new BigInteger[tests]; for (int i = 0; i < secretSharingArray.length; i++){ secrets[i] = group.sample(random); - secretSharingArray[i] = new SecretSharing(p,t,n,secrets[i],random); + secretSharingArray[i] = new SecretSharing(t,n,secrets[i],random,p); } } public void oneTest(SecretSharing secretSharing, BigInteger secret) throws Exception { - int t = secretSharing.getThreshold(); + int t = secretSharing.getT(); int n = secretSharing.getN(); Polynomial.Point[] shares = new Polynomial.Point[t + 1]; List indexes = new ArrayList(n); diff --git a/destributed-key-generation/src/test/java/FeldmanVerifiableSecretSharing/VerifiableSecretSharingTest.java b/destributed-key-generation/src/test/java/FeldmanVerifiableSecretSharing/VerifiableSecretSharingTest.java index ec58262..cb18f3f 100644 --- a/destributed-key-generation/src/test/java/FeldmanVerifiableSecretSharing/VerifiableSecretSharingTest.java +++ b/destributed-key-generation/src/test/java/FeldmanVerifiableSecretSharing/VerifiableSecretSharingTest.java @@ -20,7 +20,7 @@ public class VerifiableSecretSharingTest { int tests = 1 << 10; Random random; - @Before + //@Before public void settings(){ BigInteger p = BigInteger.valueOf(2903); BigInteger q = p.subtract(BigInteger.ONE).divide(BigInteger.valueOf(2)); @@ -45,7 +45,7 @@ public class VerifiableSecretSharingTest { BigInteger[] commitments = verifiableSecretSharing.getCommitments(); BigInteger[] verifications = new BigInteger[n]; for (int i = 1 ; i <= shares.length; i ++){ - shares[i - 1] = verifiableSecretSharing.getShare(i); + shares[i - 1] = verifiableSecretSharing.getShareForTest(i); verifications[i - 1] = VerifiableSecretSharing.verify(i,commitments,zpstar); } BigInteger expected; @@ -56,11 +56,10 @@ public class VerifiableSecretSharingTest { } - @Test + //@Test public void secretSharingTest() throws Exception { for (int i = 0 ; i < verifiableSecretSharingArray.length; i ++){ oneTest(verifiableSecretSharingArray[i]); - } } }