Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase sparsity of pippenger fixed window naf representation #513

Merged
merged 4 commits into from
Apr 5, 2018

Conversation

jonasnick
Copy link
Contributor

@jonasnick jonasnick commented Mar 1, 2018

Fixes #506

@jonasnick
Copy link
Contributor Author

ecmult_multi pippenger speedup

without endo:    2 points 11%,     pippenger threshold (160 points) 0.74%
with endo:       2 points 10%,     pippenger threshold (88 points)  2.1%    

@jonasnick
Copy link
Contributor Author

Added wnaf_fixed bugfix and two commits that further increase sparsity. Now it's possible to use precomputation with pippenger similar to using the endomorphism: split a scalar, point pair (s, G) into (s1, ..., sn, G, ..., Gn) where all si have 256 -256/n leading zeros and s1*G + ... + sn*Gn = s*G.

With 128 points and n=8 this gives a speedup of 6% over endomorphism (13% over non-endo). See https://github.com/jonasnick/secp256k1/blob/bench_ecmult_precomp/src/bench_ecmult_precomp.c#L138 for the benchmarking and splitting code.

@sipa
Copy link
Contributor

sipa commented Mar 27, 2018

Lightly tested ACK ec0a7b3

@apoelstra
Copy link
Contributor

Let me test it with the BP code before merging.

@apoelstra
Copy link
Contributor

ACK

@sipa sipa merged commit ec0a7b3 into bitcoin-core:master Apr 5, 2018
sipa added a commit that referenced this pull request Apr 5, 2018
…ation

ec0a7b3 Don't touch leading zeros in wnaf_fixed. (Jonas Nick)
9e36d1b Fix bug in wnaf_fixed where the wnaf array is not completely zeroed when given a 0 scalar. (Jonas Nick)
96f68a0 Don't invert scalar in wnaf_fixed when it is even because a caller might intentionally give a scalar with many leading zeros. (Jonas Nick)
6dbb007 Increase sparsity of pippenger fixed window naf representation (Jonas Nick)

Pull request description:

  Fixes #506

Tree-SHA512: 49a237a7d09c0c376ba4e6b1f522b9aff2517e420dfef9df810fd5ba920e0b98be8fe3f730b32e41b4aef475bc4cf3b13220024bd8d6f40c2744e6f392ff97a8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants