Elliptic Curve Multiplication Function

前端 未结 1 811
醉话见心
醉话见心 2021-01-16 06:57

I\'m trying to make my own library for the elliptic curve. Some things work, but some others don\'t.

To calculate a public key from a private key, you should multipl

1条回答
  •  醉梦人生
    2021-01-16 07:20

    Yes there is something wrong with your code; you are trying to divide in Z (using BigInteger) when you need to divide in Zp (aka Z/pZ) where p is the curve parameter defining the underlying field (for secp256k1 see SEC2). Modular division is implemented in Java by taking the modular inverse and modular-multiplying; see Scalar Multiplication of Point over elliptic Curve . Also you need to take at least the final results mod p, and it is usually more efficient to do the stepwise results as well.

    0 讨论(0)
提交回复
热议问题