Comments (6)
What specifically are you looking to learn from? A combination of wNAF and endomorphism? Or these things in separate?
from noble-secp256k1.
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.
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:
- Use code without endomorphism. Just copy everything inside
if
s likeif (!USE_ENDOMORPHISM)
- 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.
Thank you, I will read the description of Endomorphism carefully, can you give me some information about wNAF
from noble-secp256k1.
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.
thanks
from noble-secp256k1.
Related Issues (20)
- Hex private keys should be more permissive. HOT 3
- Need a new function for a recovery(v) for HSM
- Upgrade to v2 causes etc.hmacSha256Sync not set HOT 1
- How do I initialize a Signature with the v2? HOT 3
- Non-https website don't have subtle property in window.crypto HOT 1
- Is possible to detect Cloudflare workers or add browser target? HOT 2
- {Help wanted} TypeError: undefined is not a function HOT 1
- More specific web crypto condition
- options @param sign(msgHash, privateKey, opts?) HOT 1
- Consider using subtle from global object instead of crypto module HOT 3
- What `xOnlyPointFromPoint()` equivalent would look like? HOT 1
- Signatures will randomly return as invalid. HOT 1
- nodeCrypto is truthy when disabled HOT 6
- Backwards compatbility with secp256k1-node HOT 3
- 1.7.1: `Point.add` is not throwing for "1 + -1 == 0/Infinity" HOT 3
- Removed v2 code snippets HOT 4
- Is this compatible with the elliptic package? HOT 4
- [doc] privateKeyTweakAdd and publicKeyTweakAdd for HD Wallets HOT 3
- Suggestion: Use globalThis.crypto instead of node crypto for cross-platform compatibility. HOT 2
- Generate seed phrase from private key HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from noble-secp256k1.