Struct ethkey::Secret [−][src]
pub struct Secret { /* fields omitted */ }Methods
impl Secret[src]
impl Secretpub fn from_slice(key: &[u8]) -> Option<Self>[src]
pub fn from_slice(key: &[u8]) -> Option<Self>Creates a Secret from the given slice, returning None if the slice length != 32.
pub fn zero() -> Self[src]
pub fn zero() -> SelfCreates zero key, which is invalid for crypto operations, but valid for math operation.
pub fn from_unsafe_slice(key: &[u8]) -> Result<Self, Error>[src]
pub fn from_unsafe_slice(key: &[u8]) -> Result<Self, Error>Imports and validates the key.
pub fn check_validity(&self) -> Result<(), Error>[src]
pub fn check_validity(&self) -> Result<(), Error>Checks validity of this key.
pub fn add(&mut self, other: &Secret) -> Result<(), Error>[src]
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>[src]
pub fn sub(&mut self, other: &Secret) -> Result<(), Error>Inplace subtract one secret key from another (scalar - scalar)
pub fn dec(&mut self) -> Result<(), Error>[src]
pub fn dec(&mut self) -> Result<(), Error>Inplace decrease secret key (scalar - 1)
pub fn mul(&mut self, other: &Secret) -> Result<(), Error>[src]
pub fn mul(&mut self, other: &Secret) -> Result<(), Error>Inplace multiply one secret key to another (scalar * scalar)
pub fn neg(&mut self) -> Result<(), Error>[src]
pub fn neg(&mut self) -> Result<(), Error>Inplace negate secret key (-scalar)
pub fn inv(&mut self) -> Result<(), Error>[src]
pub fn inv(&mut self) -> Result<(), Error>Inplace inverse secret key (1 / scalar)
pub fn pow(&mut self, pow: usize) -> Result<(), Error>[src]
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>[src]
pub fn to_secp256k1_secret(&self) -> Result<SecretKey, Error>Create secp256k1::key::SecretKey based on this secret
Methods from Deref<Target = H256>
pub fn copy_to(&self, dest: &mut [u8])
pub fn copy_to(&self, dest: &mut [u8])Copy the data of this object into some mutable slice of length len().
pub fn contains(&'a self, b: &'a H256) -> bool
pub fn contains(&'a self, b: &'a H256) -> boolReturns true if all bits set in b are also set in self.
pub fn is_zero(&self) -> bool
pub fn is_zero(&self) -> boolReturns true if no bits are set.
pub fn low_u64(&self) -> u64
pub fn low_u64(&self) -> u64Returns the lowest 8 bytes interpreted as a BigEndian integer.
pub fn hex(&self) -> String
pub fn hex(&self) -> String: Use LowerHex or Debug formatting instead.
Get a hex representation.
Trait Implementations
impl Clone for Secret[src]
impl Clone for Secretfn clone(&self) -> Secret[src]
fn clone(&self) -> SecretReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl PartialEq for Secret[src]
impl PartialEq for Secretfn eq(&self, other: &Secret) -> bool[src]
fn eq(&self, other: &Secret) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Secret) -> bool[src]
fn ne(&self, other: &Secret) -> boolThis method tests for !=.
impl Eq for Secret[src]
impl Eq for Secretimpl ToHex for Secret[src]
impl ToHex for Secretfn to_hex(&self) -> String[src]
fn to_hex(&self) -> StringConverts the value of self to a hex value, returning the owned string. Read more
impl LowerHex for Secret[src]
impl LowerHex for Secretimpl Debug for Secret[src]
impl Debug for Secretfn fmt(&self, fmt: &mut Formatter) -> Result[src]
fn fmt(&self, fmt: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Display for Secret[src]
impl Display for Secretfn fmt(&self, fmt: &mut Formatter) -> Result[src]
fn fmt(&self, fmt: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl FromStr for Secret[src]
impl FromStr for Secrettype Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>[src]
fn from_str(s: &str) -> Result<Self, Self::Err>Parses a string s to return a value of this type. Read more
impl From<[u8; 32]> for Secret[src]
impl From<[u8; 32]> for Secretimpl From<H256> for Secret[src]
impl From<H256> for Secretimpl From<&'static str> for Secret[src]
impl From<&'static str> for Secretimpl From<SecretKey> for Secret[src]
impl From<SecretKey> for Secretimpl Deref for Secret[src]
impl Deref for Secret