ToBigInteger() public method

public ToBigInteger ( ) : BigInteger
return BigInteger
Beispiel #1
0
        /**
         * Solves a quadratic equation <code>z<sup>2</sup> + z = beta</code>(X9.62
         * D.1.6) The other solution is <code>z + 1</code>.
         *
         * @param beta
         *            The value to solve the qradratic equation for.
         * @return the solution for <code>z<sup>2</sup> + z = beta</code> or
         *         <code>null</code> if no solution exists.
         */
        private ECFieldElement solveQuadradicEquation(ECFieldElement beta)
        {
            if (beta.x.SignValue == 0)
            {
                return(new F2mFieldElement(
                           this.m, this.k1, this.k2, this.k3, BigInteger.Zero));
            }
            ECFieldElement z     = null;
            ECFieldElement gamma = new F2mFieldElement(this.m, this.k1,
                                                       this.k2, this.k3, BigInteger.Zero);

            while (gamma.ToBigInteger().SignValue == 0)
            {
                ECFieldElement t = new F2mFieldElement(this.m, this.k1,
                                                       this.k2, this.k3, new BigInteger(m, new Random()));
                z = new F2mFieldElement(this.m, this.k1, this.k2, this.k3,
                                        BigInteger.Zero);
                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.x.SignValue != 0)
                {
                    return(null);
                }
                gamma = z.Square().Add(z);
            }
            return(z);
        }
Beispiel #2
0
 /**
  * Solves a quadratic equation <code>z<sup>2</sup> + z = beta</code>(X9.62
  * D.1.6) The other solution is <code>z + 1</code>.
  *
  * @param beta
  *            The value to solve the qradratic equation for.
  * @return the solution for <code>z<sup>2</sup> + z = beta</code> or
  *         <code>null</code> if no solution exists.
  */
 private ECFieldElement solveQuadradicEquation(ECFieldElement beta)
 {
     if (beta.x.SignValue == 0)
     {
         return new F2mFieldElement(
                 this.m, this.k1, this.k2, this.k3, BigInteger.Zero);
     }
     ECFieldElement z = null;
     ECFieldElement gamma = new F2mFieldElement(this.m, this.k1,
             this.k2, this.k3, BigInteger.Zero);
     while (gamma.ToBigInteger().SignValue == 0)
     {
         ECFieldElement t = new F2mFieldElement(this.m, this.k1,
                 this.k2, this.k3, new BigInteger(m, new Random()));
         z = new F2mFieldElement(this.m, this.k1, this.k2, this.k3,
                 BigInteger.Zero);
         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.x.SignValue != 0)
         {
             return null;
         }
         gamma = z.Square().Add(z);
     }
     return z;
 }