pub struct Message(_);
Expand description

A (hashed) message input to an ECDSA signature.

Implementations

Converts the object to a raw pointer for FFI interfacing

Converts the object to a mutable raw pointer for FFI interfacing

Returns the length of the object as an array

Returns whether the object as an array is empty

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.

Available on crate feature bitcoin_hashes only.

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

Gets a reference to the underlying array

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Converts a 32-byte hash directly to a message without error paths.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Formats the value using the given formatter.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Outputs the hash in hexadecimal form.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.