public static void makeParam() {
    BigInteger ZERO = BigInteger.ZERO;
    BigInteger ONE = BigInteger.ONE;
    BigInteger TWO = BigIntegerUtil.TWO;

    int Lp = 512;
    int Lq = 511;

    Random sc = new SecureRandom();
    int k = Lp; // prime number with k=512 bits
    int certainty = 100; // The probability that the new BigInteger represents a prime number will
                         // exceed (1-1/2^certainty)

    BigInteger p = null;
    BigInteger q = null;
    do {
      q = new BigInteger(k - 1, certainty, sc);
      p = q.multiply(TWO).add(ONE); // secure prime p = 2q+1
    } while (!p.isProbablePrime(certainty));

    BigInteger MINUS_ONE = ONE.negate().mod(p); // -1 mod p

    BigInteger g1 = null;
    BigInteger factor = null;
    do {
      // 2 <= g < p-1
      g1 = BigIntegerUtil.randomBetween(TWO, p.subtract(ONE), sc);
      factor = g1.modPow(q, p);
    } while (!factor.equals(MINUS_ONE));

    BigInteger g2 = null;
    BigInteger factor2 = null;
    do {
      do {
        // 2 <= g < p-1
        g2 = BigIntegerUtil.randomBetween(TWO, p.subtract(ONE), sc);
        factor2 = g2.modPow(q, p);
      } while (!factor2.equals(MINUS_ONE));
    } while (g1.equals(g2));

    String paramString = p + "\n" + g1 + "\n" + g2;

    try {
      BufferedWriter param = new BufferedWriter(new FileWriter("HashParameter"));
      param.write(paramString);
      param.close();
    } catch (IOException e1) {
      e1.printStackTrace();
    }

  }