Skip to main content

Scalar

Trait Scalar 

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

Types representing a valid non-zero scalar of 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

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

Available on crate features x25519 or ed25519 only.
Source§

fn random() -> Self

Source§

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

Implementors§