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
const constructors for hashes #2377
Comments
FYI I had a PR to do this but it got stale and I'm actually currently working on a replacement since the hash stuff got complicated. |
Actually hashing in constant time is far from trivial, though I haven't tried in a little while. |
|
Oh, lol :). So @stevenroose there is a const constructor. But agreed that |
Definitely! |
Seems that Rust does not allow functions within traits to be marked as ref: https://users.rust-lang.org/t/whats-the-reason-that-fn-in-a-trait-cannot-marked-as-a-const/68636 |
Ah, yeah, that is probably why these aren't const already. We should move those methods out of the trait into inherents. |
Yes! |
rust-bitcoin/hashes/src/sha256t.rs Line 23 in 9df5963
In |
|
…hem const Made these functions const fn & move them from the `Hash` trait to `hash_type` & `hash_newtype` macros fix rust-bitcoin#2377
…hem const Made these functions const fn & move them from the `Hash` trait to `hash_type` & `hash_newtype` macros fix rust-bitcoin#2377
Made these functions const fn & move them from the `Hash` trait to `hash_type` & `hash_newtype` macros fix rust-bitcoin#2377
The hashes currently have no const constructors (not even
from_byte_array
orall_zeros
).I found out because I was trying to make
OutPoint::new
andOutPoint::null
const fns, but the latter is impossible, it seems.The text was updated successfully, but these errors were encountered: