public static BigInteger getG(BigInteger p, BigInteger p_MinusOne) { BigInteger g = null; outterLoop: for (int i = 2; i < 50; i++) { for (int x1 = 1; x1 <= Integer.valueOf(p_MinusOne.toString()); x1++) { String str1 = String.valueOf(i); String str2 = String.valueOf(x1); BigInteger tmp1 = new BigInteger(str1); BigInteger tmp2 = new BigInteger(str2); if (tmp1.modPow(tmp2, p).compareTo(ONE) == 0 && tmp2.compareTo(p_MinusOne) == -1) { break; } else if (tmp1.modPow(tmp2, p).compareTo(ONE) == 0 && tmp2.compareTo(p_MinusOne) == 0) { g = tmp1; break outterLoop; } } } return g; }
62,614
社区成员
307,326
社区内容
加载中
试试用AI创作助手写篇文章吧