hopr_crypto_sphinx::shared_keys

Trait Scalar

Source
pub trait Scalar: Mul<Output = Self> + Sized {
    // Required methods
    fn random() -> Self;
    fn from_bytes(bytes: &[u8]) -> Result<Self>;
    fn to_bytes(&self) -> Box<[u8]>;
}
Expand description

Types representing a valid non-zero scalar an additive abelian group.

Required Methods§

Source

fn random() -> Self

Generates a random scalar using a cryptographically secure RNG.

Source

fn from_bytes(bytes: &[u8]) -> Result<Self>

Create scalar from bytes

Source

fn to_bytes(&self) -> Box<[u8]>

Convert scalar to bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Scalar for Scalar

Source§

fn random() -> Self

Source§

fn from_bytes(bytes: &[u8]) -> Result<Self>

Source§

fn to_bytes(&self) -> Box<[u8]>

Implementors§