This commit implements the subtraction operator (sub) for the GE (Group Element) class in the secp256k1.py file as requested in the TODO comment in reference.py.
The implementation is straightforward, leveraging the existing neg method to define subtraction as addition with the negated element: self + (-a).
After implementing the operator, the code in reference.py was simplified by replacing expressions like:
s * G + (-e * A) with s * G - e * A
This makes the code more readable and directly matches the mathematical notation used in the BIP-0374 specification.
Co-Authored-By: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
* BIP374: Add message to rand computation
* BIP374: Update reference and test vectors
* Add changelog
* Format changelog according to BIP3
* Add creation date
Co-authored-by: Jon Atack <jon@atack.com>
* Grammar fix
Co-authored-by: Jon Atack <jon@atack.com>
* update changelog
---------
Co-authored-by: Jon Atack <jon@atack.com>
- added 1 more successful test vectors.
now there are 8 test vectors[test vectors 0..7].
- test vector 5 has optional message
- test vectors 5, 6, 7 have G=GENERATOR
Both generating and verifying a proof allows for specifying a custom
generator point G. But that custom generator point was not passed into
the dleq_challenge function, resulting in the default (secp256k1)
generator point to be used. This lead to the test vectors being
incorrect.