rust-bitcoin / rust-secp256k1

Rust language bindings for Bitcoin secp256k1 library.
Creative Commons Zero v1.0 Universal
345 stars 264 forks source link

Expose sha256 hashing methods in rust-secp256k1-sys (including tagged hash) #339

Closed junderw closed 2 years ago

junderw commented 2 years ago

Methods:

Reasoning:

Currently, schnorrsig upstream is using mid-state of certain tagged hashes to make schnorr sign etc. a bit faster. By exposing these methods, we could provide similar performance versions of each of the tagged hashes used in various bitcoin use cases.

dr-orlovsky commented 2 years ago

Why just not to increase rust performance instead of increasing C dependency base for trivial functionality? We do not expose any hashing functions from secp and use pure rust implementation in bitcoin_hashes, I do not see why to make an exclusion for tagged hashes.

real-or-random commented 2 years ago

The SHA256 function are (currently) internal functions of the C library, we really should not expose them here.

junderw commented 2 years ago

Sorry, it seems I've missed the forest for the trees here a bit.

You are right, this would be better served with an issue/PR to bitcoin_hashes.