pub struct Secret { /* private fields */ }
Implementations§
§impl Secret
impl Secret
pub fn from_slice(key: &[u8]) -> Option<Secret>
pub fn from_slice(key: &[u8]) -> Option<Secret>
Creates a Secret
from the given slice, returning None
if the slice
length != 32.
pub fn zero() -> Secret
pub fn zero() -> Secret
Creates zero key, which is invalid for crypto operations, but valid for math operation.
pub fn from_unsafe_slice(key: &[u8]) -> Result<Secret, Error>
pub fn from_unsafe_slice(key: &[u8]) -> Result<Secret, Error>
Imports and validates the key.
pub fn check_validity(&self) -> Result<(), Error>
pub fn check_validity(&self) -> Result<(), Error>
Checks validity of this key.
pub fn add(&mut self, other: &Secret) -> Result<(), Error>
pub fn add(&mut self, other: &Secret) -> Result<(), Error>
Inplace add one secret key to another (scalar + scalar)
pub fn sub(&mut self, other: &Secret) -> Result<(), Error>
pub fn sub(&mut self, other: &Secret) -> Result<(), Error>
Inplace subtract one secret key from another (scalar - scalar)
pub fn mul(&mut self, other: &Secret) -> Result<(), Error>
pub fn mul(&mut self, other: &Secret) -> Result<(), Error>
Inplace multiply one secret key to another (scalar * scalar)
pub fn pow(&mut self, pow: usize) -> Result<(), Error>
pub fn pow(&mut self, pow: usize) -> Result<(), Error>
Compute power of secret key inplace (secret ^ pow). This function is not intended to be used with large powers.
pub fn to_secp256k1_secret(&self) -> Result<SecretKey, Error>
pub fn to_secp256k1_secret(&self) -> Result<SecretKey, Error>
Create secp256k1::key::SecretKey
based on this secret
pub fn to_hex(&self) -> String
Methods from Deref<Target = H256>§
pub fn as_fixed_bytes(&self) -> &[u8; 32]
pub fn as_fixed_bytes(&self) -> &[u8; 32]
Extracts a reference to the byte array containing the entire fixed hash.
pub fn to_low_u64_be(&self) -> u64
pub fn to_low_u64_be(&self) -> u64
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.
pub fn to_low_u64_le(&self) -> u64
pub fn to_low_u64_le(&self) -> u64
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.
pub fn to_low_u64_ne(&self) -> u64
pub fn to_low_u64_ne(&self) -> u64
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§
impl Eq for Secret
impl StructuralPartialEq for Secret
Auto Trait Implementations§
impl Freeze for Secret
impl RefUnwindSafe for Secret
impl Send for Secret
impl Sync for Secret
impl Unpin for Secret
impl UnwindSafe for Secret
Blanket Implementations§
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
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
key
and return true
if they are equal.