-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Flesh out Schnorr/BIP340 functionality #50
Conversation
brandonblack
commented
Feb 24, 2022
- Add and export sign/verify sync for Schnorr
- Add a cache for tagged hash prefixes
- Simplify creating tag bytes for tagged hash
- Export taggedHash and new taggedHashSync
Started down this path to let |
ece9b59
to
09ec1e5
Compare
I added the remaining functions necessary to let this library be wrapped up and used with edit to add link to the WIP wrapper: https://github.com/BitGo/BitGoJS/blob/bitcoinjs_lib_6_sync/modules/utxo-lib/src/noble_ecc.ts This PR at least needs some tests for the new functions. I'll try to get those added early next week. |
Great! |
* Schnorr signatures changed because lack of extra nonce data is now empty buffer instead of skipped * tiny-secp256k1 no longer works in browser w/o WASM support, so switched crypto implementation to noble-secp256k1 * Required some moderately extensive changes to noble-secp256k1 paulmillr/noble-secp256k1#50 Issue: BG-41154
Alright, got those tests in. I see you already had vectors for the more complex two. Was there a strong reason they weren't implemented? |
More complex two? |
|
BTW, I forgot to mention that I benchmarked many different ways of doing this, found all the ways that don't depend on nodejs Buffer to be slow, and settled on using a cache with one of the slower, but simpler methods. For a million iterations of converting the tag to bytes, the original code is ~1s on my computer vs. the new at ~2s. The only way that was marginally faster (.7s) was:
|
* Add and export sign/verify sync for Schnorr * Add a cache for tagged hash prefixes * Simplify creating tag bytes for tagged hash * Export taggedHash and new taggedHashSync * Add and export some additional useful ecc utility functions
Going through the review, a bit slowly — sorry, in a war right now, hoping to merge this ASAP! |
Usually developers say that tongue in cheek because a server is throwing 500s, but you really mean it. Sorry. Stay safe out there! |
@brandonblack why do you need these?
Is it only for BIP32? I'd prefer to not add them into noble, because in this case we'll have two different methods of doing the same thing. |
Yes, I added these for |
* Schnorr signatures changed because lack of extra nonce data is now empty buffer instead of skipped * tiny-secp256k1 no longer works in browser w/o WASM support, so switched crypto implementation to noble-secp256k1 * Required some moderately extensive changes to noble-secp256k1 paulmillr/noble-secp256k1#50 Issue: BG-41154
* Schnorr signatures changed because lack of extra nonce data is now empty buffer instead of skipped * tiny-secp256k1 no longer works in browser w/o WASM support, so switched crypto implementation to noble-secp256k1 * Required some moderately extensive changes to noble-secp256k1 paulmillr/noble-secp256k1#50 Issue: BG-41154
* Schnorr signatures changed because lack of extra nonce data is now empty buffer instead of skipped * tiny-secp256k1 no longer works in browser w/o WASM support, so switched crypto implementation to noble-secp256k1 * Required some moderately extensive changes to noble-secp256k1 paulmillr/noble-secp256k1#50 Issue: BG-41154