[][src]Struct tari_crypto::ristretto::ristretto_keys::RistrettoSecretKey

pub struct RistrettoSecretKey(_);

The SecretKey implementation for Ristretto is a thin wrapper around the Dalek Scalar type, representing a 256-bit integer (mod the group order).

Creating secret keys

ByteArray and SecretKeyFactory are implemented for SecretKey(struct .SecretKey.html), so any of the following work (note that hex strings and byte array are little-endian):

This code runs with edition 2018
use tari_crypto::ristretto::RistrettoSecretKey;
use tari_utilities::{ ByteArray, hex::Hex };
use tari_crypto::keys::SecretKey;
use rand;

let mut rng = rand::thread_rng();
let _k1 = RistrettoSecretKey::from_bytes(&[1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]);
let _k2 = RistrettoSecretKey::from_hex(&"100000002000000030000000040000000");
let _k3 = RistrettoSecretKey::random(&mut rng);

Trait Implementations

impl<'a, 'b> Add<&'b RistrettoSecretKey> for &'a RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the + operator.

impl<'b> Add<&'b RistrettoSecretKey> for RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the + operator.

impl<'a> Add<RistrettoSecretKey> for &'a RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the + operator.

impl Add<RistrettoSecretKey> for RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the + operator.

impl ByteArray for RistrettoSecretKey[src]

fn from_bytes(bytes: &[u8]) -> Result<RistrettoSecretKey, ByteArrayError> where
    Self: Sized
[src]

Create a secret key on the Ristretto255 curve using the given little-endian byte array. If the byte array is not exactly 32 bytes long, from_bytes returns an error. This function is guaranteed to return a valid key in the group since it performs a mod l on the input.

fn as_bytes(&self) -> &[u8][src]

Return the byte array for the secret key in little-endian order

impl Clone for RistrettoSecretKey[src]

impl Debug for RistrettoSecretKey[src]

impl Default for RistrettoSecretKey[src]

impl<'de> Deserialize<'de> for RistrettoSecretKey[src]

impl Drop for RistrettoSecretKey[src]

Clear the secret key value in memory when it goes out of scope

impl Eq for RistrettoSecretKey[src]

impl From<RistrettoSecretKey> for Scalar[src]

impl From<u64> for RistrettoSecretKey[src]

impl Hash for RistrettoSecretKey[src]

fn hash<H: Hasher>(&self, state: &mut H)[src]

Require the implementation of the Hash trait for Hashmaps

impl<'a, 'b> Mul<&'b RistrettoPublicKey> for &'a RistrettoSecretKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl<'b> Mul<&'b RistrettoPublicKey> for RistrettoSecretKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b RistrettoSecretKey> for &'a RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b RistrettoSecretKey> for &'a RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the * operator.

impl<'b> Mul<&'b RistrettoSecretKey> for RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl<'b> Mul<&'b RistrettoSecretKey> for RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the * operator.

impl<'a> Mul<RistrettoPublicKey> for &'a RistrettoSecretKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl Mul<RistrettoPublicKey> for RistrettoSecretKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl<'a> Mul<RistrettoSecretKey> for &'a RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl Mul<RistrettoSecretKey> for RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl<'a> Mul<RistrettoSecretKey> for &'a RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the * operator.

impl Mul<RistrettoSecretKey> for RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the * operator.

impl PartialEq<RistrettoSecretKey> for RistrettoSecretKey[src]

impl SecretKey for RistrettoSecretKey[src]

fn random<R: Rng + CryptoRng>(rng: &mut R) -> Self[src]

Return a random secret key on the ristretto255 curve using the supplied CSPRNG.

impl Serialize for RistrettoSecretKey[src]

impl StructuralEq for RistrettoSecretKey[src]

impl<'a, 'b> Sub<&'b RistrettoSecretKey> for &'a RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the - operator.

impl<'b> Sub<&'b RistrettoSecretKey> for RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the - operator.

impl<'a> Sub<RistrettoSecretKey> for &'a RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the - operator.

impl Sub<RistrettoSecretKey> for RistrettoSecretKey[src]

type Output = RistrettoSecretKey

The resulting type after applying the - operator.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> Cast<U> for T where
    U: FromCast<T>, 

impl<T> Clear for T where
    T: InitializableFromZeroed + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T> FromBits<T> for T

impl<T> FromCast<T> for T

impl<T> Hex for T where
    T: ByteArray
[src]

type T = T

impl<T> InitializableFromZeroed for T where
    T: Default
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> IntoBits<U> for T where
    U: FromBits<T>, 

impl<T> MessageFormat for T where
    T: DeserializeOwned + Serialize
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,