【问题标题】:Scalar Multiplication for elliptic curve over Prime Field素数场上椭圆曲线的标量乘法
【发布时间】:2013-11-10 13:57:47
【问题描述】:

我正在尝试在 P192r1 的素数字段上实现标量乘法。使用从java Scalar Multiplication借来的代码可以正常添加点

但是关于我从那个链接再次使用代码的点加倍,它没有得到正确的结果。我试图找出错误,但我找不到。有没有人已经解决了这个错误。

 `public static ECPoint doublePoint(ECPoint r) {
        // TODO Auto-generated method stub

 BigInteger ONE = new BigInteger("1");;
 BigInteger TWO = new BigInteger("2");
 BigInteger p = new BigInteger("6277101735386680763835789423207666416083908700390324961279");

        BigInteger slope = (r.getAffineX().pow(2)).multiply(new BigInteger("3"));

        slope = slope.add(new BigInteger("3"));
        slope = slope.multiply((r.getAffineY().multiply(TWO)).modInverse(p));
        BigInteger Xout = slope.pow(2).subtract(r.getAffineX().multiply(new BigInteger("2"))).mod(p);
        BigInteger Yout = (r.getAffineY().negate()).add(slope.multiply(r.getAffineX().subtract(Xout))).mod(p);
        ECPoint out = new ECPoint(Xout, Yout);
        return out;
    }`

【问题讨论】:

标签: java elliptic-curve


【解决方案1】:

原代码在这一行加了3

slope = slope.add(new BigInteger("3"));

但应该是加a,所以换成这一行

slope = slope.add(a);

a 在哪里

static BigInteger a = new BigInteger("6277101735386680763835789423207666416083908700390324961276");

然后你会得到

Doubling is correct

当你运行主函数时。

【讨论】:

    猜你喜欢
    • 2013-03-21
    • 1970-01-01
    • 1970-01-01
    • 2010-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多