Struct Message
pub struct Message(/* private fields */);
Expand description
A (hashed) message input to an ECDSA signature.
Implementations§
§impl Message
impl Message
pub fn as_mut_ptr(&mut self) -> *mut u8
pub fn as_mut_ptr(&mut self) -> *mut u8
Converts the object to a mutable raw pointer for FFI interfacing
§impl Message
impl Message
pub fn from_slice(data: &[u8]) -> Result<Message, Error>
pub fn from_slice(data: &[u8]) -> Result<Message, Error>
If you just want to sign an arbitrary message use Message::from_hashed_data
instead.
Converts a MESSAGE_SIZE
-byte slice to a message object. WARNING: the slice has to be a
cryptographically secure hash of the actual message that’s going to be signed. Otherwise
the result of signing isn’t a
secure signature.
pub fn from_hashed_data<H>(data: &[u8]) -> Messagewhere
H: ThirtyTwoByteHash + Hash,
pub fn from_hashed_data<H>(data: &[u8]) -> Messagewhere
H: ThirtyTwoByteHash + Hash,
Constructs a Message
by hashing data
with hash algorithm H
. This requires the feature
bitcoin_hashes
to be enabled.
extern crate bitcoin_hashes;
use secp256k1::Message;
use bitcoin_hashes::sha256;
use bitcoin_hashes::Hash;
let m1 = Message::from_hashed_data::<sha256::Hash>("Hello world!".as_bytes());
// is equivalent to
let m2 = Message::from(sha256::Hash::hash("Hello world!".as_bytes()));
assert_eq!(m1, m2);
Trait Implementations§
§impl<T> From<T> for Messagewhere
T: ThirtyTwoByteHash,
impl<T> From<T> for Messagewhere
T: ThirtyTwoByteHash,
§impl Ord for Message
impl Ord for Message
§impl PartialOrd for Message
impl PartialOrd for Message
impl Copy for Message
impl Eq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request