Git Product home page Git Product logo

Comments (6)

paulmillr avatar paulmillr commented on May 23, 2024

What specifically are you looking to learn from? A combination of wNAF and endomorphism? Or these things in separate?

from noble-secp256k1.

vae520283995 avatar vae520283995 commented on May 23, 2024

Thank you for your reply. I use java. I want to implement a java version of secp256k1 through your post. I have now completed Jacobi, but I can’t complete the following wNAF and endomorphism because I don’t understand the principles inside.
By the way, another question, I use BigInteger.modInverse in java to be faster than your egcd, I don’t know why, thank you

from noble-secp256k1.

paulmillr avatar paulmillr commented on May 23, 2024

Endomorphism is described here https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066

I've added USE_ENDOMORPHISM option, but it's actually always enabled right now. It can be false only if you manually set it to false.

You have two options:

  1. Use code without endomorphism. Just copy everything inside ifs like if (!USE_ENDOMORPHISM)
  2. Use code with endomorphism. Just copy everything from cases like if (USE_ENDOMORPHISM)

So, if you don't want to use endo, your multiplyUnsafe would look like this:

    if (typeof scalar !== 'number' && typeof scalar !== 'bigint') {
      throw new TypeError('Point#multiply: expected number or bigint');
    }
    let n = mod(BigInt(scalar), CURVE.n);
    if (n <= 0) {
      throw new Error('Point#multiply: invalid scalar, expected positive integer');
    }
    let p = JacobianPoint.ZERO;
    let d: JacobianPoint = this;
    while (n > 0n) {
      if (n & 1n) p = p.add(d);
      d = d.double();
      n >>= 1n;
    }
    return p;

from noble-secp256k1.

vae520283995 avatar vae520283995 commented on May 23, 2024

Thank you, I will read the description of Endomorphism carefully, can you give me some information about wNAF

from noble-secp256k1.

paulmillr avatar paulmillr commented on May 23, 2024

It's described in wiki: https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication#w-ary_non-adjacent_form_(wNAF)_method

Basically you pre-calculate values of base point multiplied by all values from 0 to 256*16. Result of this pre-calculation is 65535 points that are later simply added between each other.

from noble-secp256k1.

vae520283995 avatar vae520283995 commented on May 23, 2024

thanks

from noble-secp256k1.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.