* <code>null</code> if no solution exists.
*/
private static ECFieldElement solveQuadradicEquation(ECFieldElement beta)
{
ECFieldElement.F2m b = (ECFieldElement.F2m)beta;
ECFieldElement zeroElement = new ECFieldElement.F2m(
b.getM(), b.getK1(), b.getK2(), b.getK3(), ECConstants.ZERO);
if (beta.toBigInteger().equals(ECConstants.ZERO))
{
return zeroElement;
}
ECFieldElement z = null;
ECFieldElement gamma = zeroElement;
Random rand = new Random();
int m = b.getM();
do
{
ECFieldElement t = new ECFieldElement.F2m(b.getM(), b.getK1(),
b.getK2(), b.getK3(), new BigInteger(m, rand));
z = zeroElement;
ECFieldElement w = beta;
for (int i = 1; i <= m - 1; i++)
{
ECFieldElement w2 = w.square();
z = z.square().add(w2.multiply(t));
w = w2.add(beta);
}
if (!w.toBigInteger().equals(ECConstants.ZERO))
{
return null;
}