Struct ethkey::Secret [−][src]
pub struct Secret { /* fields omitted */ }
Methods
impl Secret
[src]
impl Secret
pub 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() -> Self
Creates 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) -> bool
Returns true
if all bits set in b
are also set in self
.
pub fn is_zero(&self) -> bool
pub fn is_zero(&self) -> bool
Returns true
if no bits are set.
pub fn low_u64(&self) -> u64
pub fn low_u64(&self) -> u64
Returns 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 Secret
fn clone(&self) -> Secret
[src]
fn clone(&self) -> Secret
Returns 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 Secret
fn eq(&self, other: &Secret) -> bool
[src]
fn eq(&self, other: &Secret) -> bool
This 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) -> bool
This method tests for !=
.
impl Eq for Secret
[src]
impl Eq for Secret
impl ToHex for Secret
[src]
impl ToHex for Secret
fn to_hex(&self) -> String
[src]
fn to_hex(&self) -> String
Converts the value of self
to a hex value, returning the owned string. Read more
impl LowerHex for Secret
[src]
impl LowerHex for Secret
impl Debug for Secret
[src]
impl Debug for Secret
fn fmt(&self, fmt: &mut Formatter) -> Result
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for Secret
[src]
impl Display for Secret
fn fmt(&self, fmt: &mut Formatter) -> Result
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl FromStr for Secret
[src]
impl FromStr for Secret
type 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 Secret
impl From<H256> for Secret
[src]
impl From<H256> for Secret
impl From<&'static str> for Secret
[src]
impl From<&'static str> for Secret
impl From<SecretKey> for Secret
[src]
impl From<SecretKey> for Secret
impl Deref for Secret
[src]
impl Deref for Secret