예제 #1
0
 public PointJacobian(BigInteger x, BigInteger y, EllipticCurveWeierstrass E)
 {
     this.x = x;
     this.y = y;
     this.z = 1;
     this.E = E;
 }
예제 #2
0
 public PointAffine(BigInteger x, BigInteger y, BigInteger z, EllipticCurveWeierstrass E)
 {
     this.x = x;
     this.y = y;
     this.z = z;
     this.E = E;
 }
예제 #3
0
        }//projective

        public static BigInteger GetFactorJacobian(BigInteger n, int B1, int B2)
        {
            BigInteger x, y, g;
            var        E = EllipticCurveWeierstrass.GenerateCurveRandom(n, out x, out y, out g, false);
            var        P = new PointJacobian(x, y, E);

            if (g > 1 && g < n)
            {
                return(g);
            }

            //STEP 1
            var P1     = P as IPoint;
            var result = StageOneProjective(ref P1, n, B1);

            if (result > 1 || result == 0)
            {
                return(result);
            }

            //STEP 2
            result = StageTwoProjective(ref P1, n, B1, B2);

            return(result);
        }//jacobian
예제 #4
0
        public static BigInteger GetFactorAffine(BigInteger n, int B1, int B2)
        {
            BigInteger x, y, g;
            var        E = EllipticCurveWeierstrass.GenerateCurveRandom(n, out x, out y, out g, false);
            var        P = new PointAffine(x, y, E);

            if (g > 1 && g < n)
            {
                return(g);
            }
            //STEP 1
            var P1     = P as IPoint;
            var result = StageOneAffine(ref P1, n, B1);

            if (result > 1 || result == 0)
            {
                return(result);
            }

            //STEP 2
            P      = P1 as PointAffine;
            result = StageTwoAffine(ref P1, n, B1, B2);

            return(result);
        }//first & second stage
예제 #5
0
 public PointProjective(BigInteger x, BigInteger y, EllipticCurveWeierstrass E)
 {
     this.x = x;
     this.y = y;
     this.z = 1;
     this.E = E;
 }
예제 #6
0
        public override bool Equals(Object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            EllipticCurveWeierstrass E = obj as EllipticCurveWeierstrass;

            return(new EllipticCurveWeierstrass(this.a, this.b, this.n) == E);
        }