Open
Conversation
168cfb4 to
1cb23ed
Compare
- Hedged RFC 6979 nonce derivation with fresh entropy mixed into K-init - Low-S signature normalization (BIP-62) and canonical DER enforcement - Public key on-curve validation in verify and fromCompressed - Branch-balanced Montgomery ladder for scalar multiplication - Hash truncation per SEC 1 §4.1.3 for hashes wider than the curve order - Tonelli-Shanks modular square root (supports all odd primes) - Extended-Euclidean Math.inv with CPython 3.8+ pow(x,-1,n) fast path, falling back to pure-Python GCD so Python 2.7+ keeps working - PrivateKey secret range check, PEM regex-match error handling, recovery-byte range validation - New tests/testSecurity.py covering the above - Pin Python version matrix via python_requires, keep 2.7/3.4-3.13/PyPy in the Travis matrix
- Mixed affine+Jacobian addition fast path in _jacobianAdd - Bit-by-bit NAF scalar multiplication for the generator, backed by a precomputed affine [G, 2G, 4G, ..., 2^n*G] table — zero doublings on the sign hot path - Curve-specific doubling shortcuts (A=0 for secp256k1, A=-3 for P-256) - Shamir's trick with Joint Sparse Form for the two-scalar verify path - GLV endomorphism on secp256k1: split each 256-bit scalar into two ~128-bit halves and run a 4-scalar multi-exponentiation, halving verify loop length - New benchmark.py comparing against python-ecdsa and fast-ecdsa - README: updated speed table, Python-version support line, and prose describing the new algorithmic stack
18aed58 to
fc97ef0
Compare
- Replace assertTrue(a <= b) with assertLessEqual(a, b) in testSecurity.py so low-s failure messages show both operands - Document python2 invocation alongside python3 in README "Run unit tests" and "Run benchmark" sections to match the declared 2.7+ compat
45c71e8 to
6b37c09
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Security
fromDerverifyandfromCompressedMath.inv: pure-Python implementation with a C-levelpow(x, -1, n)fast path on CPython 3.8+PrivateKeysecret range, PEM regex-match error handling, recovery-byte range validationPerformance
_jacobianAdd(saves 4 mults per add when the second operand has z = 1)[G, 2G, 4G, …, 2ⁿ·G]table — zero doublings on the sign hot pathCompatibility
Math.invfallbackBenchmarks
Apple Silicon, Python 3.14, 500 rounds on secp256k1 with SHA-256 and RFC 6979 k:
Matches python-ecdsa on signing and is roughly 30% faster on verification. fast-ecdsa remains faster because it is backed by hand-tuned GMP assembly in C.
Test plan