コード例 #1
0
        private Point MultipySamePoints()
        {
            BigInteger x1 = pointP.x;
            BigInteger y1 = pointP.y;
            BigInteger x2 = pointQ.x;
            BigInteger y2 = pointQ.y;

            BigInteger lambda = ((3 * BigInteger.ModPow(x1, 2, modulo) + a) * BigIntigerMath.InverseNumberMod(2 * y1, modulo)) % modulo;
            BigInteger x3     = (BigInteger.ModPow(lambda, 2, modulo) - 2 * x1) % modulo;
            BigInteger y3     = (lambda * (x1 - x3) - y1) % modulo;

            return(new Point(x3, y3));
        }
コード例 #2
0
        private Point AddDifferentPointsPAndQ()
        {
            BigInteger x1 = pointP.x;
            BigInteger y1 = pointP.y;
            BigInteger x2 = pointQ.x;
            BigInteger y2 = pointQ.y;

            BigInteger lambda = ((y2 - y1) * BigIntigerMath.InverseNumberMod(x2 - x1, modulo)) % modulo;
            BigInteger x3     = (BigInteger.ModPow(lambda, 2, modulo) - x1 - x2) % modulo;
            BigInteger y3     = (lambda * (x1 - x3) - y1) % modulo;

            return(new Point(x3, y3));
        }