public static void SetupRandomGenProtocol(Quorum quorum) { int n = quorum.Size; for (int i = 0; i < n; i++) { TestParty<Share<BigZp>> party = new TestParty<Share<BigZp>>(); party.UnderTest = new RandGenProtocol(party, quorum.Clone() as Quorum, new BigZp(prime, i), prime); NetSimulator.RegisterParty(party); } }
public static void SetupShareMultiplicationProtocol(Quorum quorum) { int n = quorum.Size; var polyDeg = (int)Math.Ceiling(n / 3.0) - 1; var sharesA = BigShamirSharing.Share(new BigZp(prime, 20), n, polyDeg); var sharesB = BigShamirSharing.Share(new BigZp(prime, 3), n, polyDeg); for (int i = 0; i < n; i++) { TestParty<Share<BigZp>> party = new TestParty<Share<BigZp>>(); party.UnderTest = new ShareMultiplicationProtocol(party, quorum.Clone() as Quorum, new Share<BigZp>(sharesA[i]), new Share<BigZp>(sharesB[i])); NetSimulator.RegisterParty(party); } }
public static void SetupBitwiseAndProtocol(Quorum quorum) { int n = quorum.Size; var polyDeg = (int)Math.Ceiling(n / 3.0) - 1; var sharesA = BigShamirSharing.Share(new BigZp(prime, 0), n, polyDeg); var sharesB = BigShamirSharing.Share(new BigZp(prime, 1), n, polyDeg); var sharesC = BigShamirSharing.Share(new BigZp(prime, 0), n, polyDeg); var sharesD = BigShamirSharing.Share(new BigZp(prime, 0), n, polyDeg); var sharesE = BigShamirSharing.Share(new BigZp(prime, 1), n, polyDeg); var sharesF = BigShamirSharing.Share(new BigZp(prime, 1), n, polyDeg); for (int i = 0; i < n; i++) { Quorum q = quorum.Clone() as Quorum; TestParty<List<Share<BigZp>>> party = new TestParty<List<Share<BigZp>>>(); party.UnderTest = new BitwiseOperationProtocol(party, q, MakeList(sharesA[i], sharesB[i], sharesC[i]), MakeList(sharesD[i], sharesE[i], sharesF[i]), new SharedBitAnd.ProtocolFactory(party, q)); NetSimulator.RegisterParty(party); } }