PublicSharing implements Serializable { public long getSize() { long size = 0; for (final EcPoint pedersenCommitment : this.pedersenCommitments) { size += pedersenCommitment.getX().toByteArray().length + 1; } for (final BigInteger encryptedShare1 : this.encryptedShares1) { size += encryptedShare1.toByteArray().length; } for (final BigInteger encryptedShare2 : this.encryptedShares2) { size += encryptedShare2.toByteArray().length; } for (final PedersenEqRangeProof proof : this.proofs) { size += proof.getSize(); } return size; } PublicSharing(final EcPoint[] pedersenCommitments, final BigInteger[] encryptedShares1,
			final BigInteger[] encryptedShares2, final PedersenEqRangeProof[] proofs); EcPoint[] getPedersenCommitments(); BigInteger[] getEncryptedShares1(); BigInteger[] getEncryptedShares2(); PedersenEqRangeProof[] getProofs(); int getNumShares(); int getThreshold(); boolean verifyAllShares(final PaillierPublicKey[] shareholderKeys); boolean verifyShare(final int shareIndex, final PaillierPublicKey encryptionKey); EcPoint getSecretCommitment(); ShamirShare accessShare1(final int shareIndex, final PaillierPrivateKey decryptionKey); ShamirShare accessShare2(final int shareIndex, final PaillierPrivateKey decryptionKey); @Override String toString(); long getSize(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testProofPerformance() { final int keyLength = 2048; final int n = 11; final int t = ((n - 1) / 2) + 1; final PaillierKeyPair[] keyPairs = new PaillierKeyPair[n]; final PaillierPublicKey[] publicKeys = new PaillierPublicKey[n]; final PaillierPrivateKey[] privateKeys = new PaillierPrivateKey[n]; final PaillierKeyGenerator generator = new PaillierKeyGenerator(keyLength); for (int i = 0; i < n; i++) { keyPairs[i] = generator.generate(); publicKeys[i] = keyPairs[i].getPublicKey(); privateKeys[i] = keyPairs[i].getPrivateKey(); } final PublicSharingGenerator pvssDealer = new PublicSharingGenerator(n, t); PublicSharing sharing = null; for (int i = 0; i < 20; i++) { sharing = pvssDealer.shareSecret(BigInteger.valueOf(1), publicKeys); } System.out.println("Sharing size: " + sharing.getSize()); long timeNs = 0; final int iterations = 1000; for (int i = 0; i < iterations; i++) { final long start = System.nanoTime(); pvssDealer.shareRandomSecret(publicKeys); final long end = System.nanoTime(); timeNs += (end - start); } System.out.println("Total time (ms): " + timeNs / (((long) iterations) * 1_000_000.0)); }