public void GetR_Data() { var list = new BigInteger[samples]; for (int i = 0; i < samples; i++) { PoupardStern.GetR(keySize, out list[i]); } Console.WriteLine(String.Join(",", list.ToList())); }
public void GetW_Data() { var keyPair = TestUtils.GeneratePrivate(Exp, keySize); var pubKey = (RsaKeyParameters)keyPair.Public; BigK = 5000; var Modulus = pubKey.Modulus; BigInteger[] Datalist = new BigInteger[BigK]; // Initialize list of z values BigInteger[] zValues = new BigInteger[BigK]; // Generate the list of z Values for (int i = 0; i < BigK; i++) { zValues[i] = PoupardStern.SampleFromZnStar(pubKey, ps, i, BigK, keySize); } for (int i = 0; i < BigK; i++) { // Initialize list of x values. BigInteger[] xValues = new BigInteger[BigK]; // Generate r PoupardStern.GetR(keySize, out BigInteger r); for (int j = 0; j < BigK; j++) { // Compute x_i xValues[j] = zValues[j].ModPow(r, Modulus); } // Compute w PoupardStern.GetW(pubKey, ps, xValues, k, keySize, out BigInteger w); Datalist[i] = w; } Console.WriteLine(String.Join(",", Datalist.ToList())); }
public void GetWTest() { var k = 128; var BigK = k + 1; var keyPair = TestUtils.GeneratePrivate(Exp, keySize); var pubKey = (RsaKeyParameters)keyPair.Public; var Modulus = pubKey.Modulus; // Initialize list of z values BigInteger[] zValues = new BigInteger[BigK]; // Generate the list of z Values for (int i = 0; i < BigK; i++) { zValues[i] = PoupardStern.SampleFromZnStar(pubKey, ps, i, BigK, keySize); } // Initialize list of x values. BigInteger[] xValues = new BigInteger[BigK]; // Generate r PoupardStern.GetR(keySize, out BigInteger r); for (int j = 0; j < BigK; j++) { // Compute x_i xValues[j] = zValues[j].ModPow(r, Modulus); } // Compute w PoupardStern.GetW(pubKey, ps, xValues, k, keySize, out BigInteger w); // Check that the bitLength of w equals to k. Assert.IsTrue(w.BitLength <= k); }