pub struct Secret { /* private fields */ }
Expand description

Represents secret key

Implementations

Creates a Secret from the given slice, returning None if the slice length != 32. Caller is responsible to zeroize input slice.

Creates a Secret from the given str representation, returning an error for hex big endian representation of the secret. Caller is responsible to zeroize input slice.

Creates zero key, which is invalid for crypto operations, but valid for math operation.

Imports and validates the key. Caller is responsible to zeroize input slice.

Checks validity of this key.

Wrapper over hex conversion

Inplace add one secret key to another (scalar + scalar)

Inplace subtract one secret key from another (scalar - scalar)

Inplace decrease secret key (scalar - 1)

Inplace multiply one secret key to another (scalar * scalar)

Inplace negate secret key (-scalar)

Compute power of secret key inplace (secret ^ pow).

Create a secp256k1::key::SecretKey based on this secret. Warning the resulting secret key need to be zeroized manually.

Methods from Deref<Target = H256>

Extracts a byte slice containing the entire fixed hash.

Extracts a reference to the byte array containing the entire fixed hash.

Returns a constant raw pointer to the value.

Returns true if all bits set in b are also set in self.

Returns true if no bits are set.

Returns the lowest 8 bytes interpreted as big-endian.

Note

For hash type with less than 8 bytes the missing bytes are interpreted as being zero.

Returns the lowest 8 bytes interpreted as little-endian.

Note

For hash type with less than 8 bytes the missing bytes are interpreted as being zero.

Returns the lowest 8 bytes interpreted as native-endian.

Note

For hash type with less than 8 bytes the missing bytes are interpreted as being zero.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Formats the value using the given formatter.

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

This method tests for !=.

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.

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.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.