public void TestMPZLPrime() { long psize = 1024; long qsize = 160; int mr_iterations = 64; Tuple <BigInteger, BigInteger, BigInteger> tuple = MPPrime.MPZLPrime(psize, qsize, mr_iterations); }
BarnettSmartVTMF_dlog( long fieldsize, long subgroupsize) { F_size = fieldsize; G_size = subgroupsize; BigInteger foo; // Create a finite abelian group $G$ where the DDH problem is hard: // We use the unique subgroup of prime order $q$ where $p = kq + 1$. g = 0; if (subgroupsize != 0) { Tuple <BigInteger, BigInteger, BigInteger> result = MPPrime.MPZLPrime(fieldsize, subgroupsize, Constants.TMCG_MR_ITERATIONS); p = result.Item1; q = result.Item2; k = result.Item3; } System.Diagnostics.Debug.WriteLine("got primes"); // Initialize all members of the key. x_i = 0; h_i = 0; h = 1; d = 0; h_i_fp = 0; h_j = new Dictionary <String, BigInteger>(); // Choose randomly a generator $g$ of the unique subgroup of order $q$. if (subgroupsize != 0) { foo = p - 1; do { d = mpz_srandom.mpz_wrandomm(p); g = d.ModPow(k, p); // compute $g := d^k \bmod p$ }while ((g == 0 || g == 1) || g == foo); // check, whether $1 < g < p-1$ } }