forked from rust-bitcoin/rust-secp256k1
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently we provide two ways to construct a `Message` with the aim that one is type-safe and one is loosey-goosey `From<T: ThirtyTwoByteHash>` and `from_slice` respectively. We then use `from_slice` in tests and `from` in code in `rust-bitcoin`. The trait is causing us a headache every time we have to upgrade because it means that `hashes` must be the same version here and in `bitcoin`. At the cost of a little explicit safety add a function `Message::from_hash(hash: [u8; 32])` that constructs a message. Include a dirty big warning about the input hash being output from a cryptographicly sound hash algorithm. While we are at it add `Message::insecure` and deprecated `from_slice`. This makes code that uses the dangerous constructor more obvious. Also this panics instead of erroring since it is useful mainly for testing.
- Loading branch information
Showing
5 changed files
with
70 additions
and
60 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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