BIP-352: vendor secp256k1lab and use it for reference implementation#2087
Open
theStack wants to merge 4 commits intobitcoin:masterfrom
Open
BIP-352: vendor secp256k1lab and use it for reference implementation#2087theStack wants to merge 4 commits intobitcoin:masterfrom
theStack wants to merge 4 commits intobitcoin:masterfrom
Conversation
git-subtree-dir: bip-0352/secp256k1lab git-subtree-split: 44dc4bd893b8f03e621585e3bf255253e0e0fbfb
This allows to remove secp256k1.py and replace the secp256k1-specific
parts in the reference implementation. Replacement guide:
* ECKey -> Scalar
* ECKey.set(seckey_bytes) -> Scalar.from_bytes_checked(seckey_bytes)
* seckey.get_pubkey() -> seckey * G
* seckey.get_bytes() -> seckey.to_bytes()
* seckey.add(tweak_bytes) -> seckey + Scalar.from_bytes_checked(tweak_bytes)
* seckey.negate() -> seckey = -seckey
* seckey.sign_schnorr -> schnorr_sign(..., seckey.to_bytes(), ...)
* ECPubKey -> GE
* ECPubKey.set(pubkey_bytes) -> GE.from_bytes_{xonly,compressed}(pubkey_bytes)
* pubkey.get_y() % 2 == 0 -> pubkey.has_even_y()
* pubkey.get_bytes(False) -> pubkey.to_bytes_compressed()
* pubkey.get_bytes() -> pubkey.to_bytes_xonly()
* not pubkey.valid -> pubkey.infinity
* pubkey.verify_schnorr -> schnorr_verify(..., pubkey.to_bytes_xonly(), ...)
* TaggedHash -> tagged_hash
* hashlib.sha256(preimage).digest() -> hash_sha256(preimage)
Member
|
cc: @josibake, @RubenSomsen |
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.
This PR adds secp256k1lab version 1.0.0 as subtree within the
bip-0352folder [1] and takes use of it in the reference implementation. In particular, the filesecp256k1.pyis removed and theGEandScalarclasses are used from the secp256k1lab.secp256k1, replacingECPubKeyandECKey, respectively. See the main commit message for a detailed table of replacement patterns for easier review. Usage of the library is mentioned in the BIP text to be license compliant (see #2004 (comment)).Can be tested via:
[1] added via the command
$ git subtree add --prefix=bip-0352/secp256k1lab --squash https://github.com/secp256k1lab/secp256k1lab v1.0.0