pub struct Ristretto(/* private fields */);
Expand description
Ristretto transform of Curve25519, also known as ristretto255.
Trait Implementations§
Source§impl ElementOps for Ristretto
impl ElementOps for Ristretto
Source§const ELEMENT_SIZE: usize = 32usize
const ELEMENT_SIZE: usize = 32usize
Byte size of a serialized
Self::Element
.Source§type Element = RistrettoPoint
type Element = RistrettoPoint
Element of the group. Arithmetic operations requested here (addition among
elements and multiplication by a
Scalar
) must be constant-time.Source§fn identity() -> Self::Element
fn identity() -> Self::Element
Returns the identity of the group (aka point at infinity for EC groups).
Source§fn is_identity(element: &Self::Element) -> bool
fn is_identity(element: &Self::Element) -> bool
Checks if the specified element is the identity.
Source§fn serialize_element(element: &Self::Element, buffer: &mut [u8])
fn serialize_element(element: &Self::Element, buffer: &mut [u8])
Source§fn deserialize_element(buffer: &[u8]) -> Option<Self::Element>
fn deserialize_element(buffer: &[u8]) -> Option<Self::Element>
Deserializes an element from
buffer
, which is guaranteed to have length
Self::ELEMENT_SIZE
. This method returns None
if the buffer
does not correspond to a representation of a valid scalar.Source§impl Group for Ristretto
impl Group for Ristretto
Source§fn mul_generator(k: &Scalar) -> Self::Element
fn mul_generator(k: &Scalar) -> Self::Element
Multiplies the provided scalar by
ElementOps::generator()
. This operation must be
constant-time. Read moreSource§fn vartime_mul_generator(k: &Scalar) -> Self::Element
fn vartime_mul_generator(k: &Scalar) -> Self::Element
Multiplies the provided scalar by
ElementOps::generator()
.
Unlike Self::mul_generator()
, this operation does not need to be constant-time;
thus, it may employ additional optimizations. Read moreSource§fn multi_mul<'a, I, J>(scalars: I, elements: J) -> Self::Element
fn multi_mul<'a, I, J>(scalars: I, elements: J) -> Self::Element
Multiplies provided
scalars
by elements
. This operation must be constant-time
w.r.t. the given length of elements. Read moreSource§fn vartime_double_mul_generator(
k: &Scalar,
k_element: Self::Element,
r: &Scalar,
) -> Self::Element
fn vartime_double_mul_generator( k: &Scalar, k_element: Self::Element, r: &Scalar, ) -> Self::Element
Calculates
k * k_element + r * G
, where G
is the group generator. This operation
does not need to be constant-time. Read moreSource§fn vartime_multi_mul<'a, I, J>(scalars: I, elements: J) -> Self::Element
fn vartime_multi_mul<'a, I, J>(scalars: I, elements: J) -> Self::Element
Multiplies provided
scalars
by elements
. Unlike Self::multi_mul()
,
this operation does not need to be constant-time; thus, it may employ
additional optimizations. Read moreSource§impl ScalarOps for Ristretto
impl ScalarOps for Ristretto
Source§const SCALAR_SIZE: usize = 32usize
const SCALAR_SIZE: usize = 32usize
Byte size of a serialized
Self::Scalar
.Source§type Scalar = Scalar
type Scalar = Scalar
Scalar type. As per
Group
contract, scalars must form a prime field.
Arithmetic operations on scalars requested here must be constant-time.Source§fn generate_scalar<R: CryptoRng + RngCore>(rng: &mut R) -> Self::Scalar
fn generate_scalar<R: CryptoRng + RngCore>(rng: &mut R) -> Self::Scalar
Generates a random scalar based on the provided CSPRNG. This operation
must be constant-time.
Source§fn scalar_from_random_bytes(source: RandomBytesProvider<'_>) -> Self::Scalar
fn scalar_from_random_bytes(source: RandomBytesProvider<'_>) -> Self::Scalar
Generates a scalar from a
source
of random bytes. This operation must be constant-time.
The source
is guaranteed to return any necessary number of bytes. Read moreSource§fn invert_scalar(scalar: Self::Scalar) -> Self::Scalar
fn invert_scalar(scalar: Self::Scalar) -> Self::Scalar
Inverts the
scalar
, which is guaranteed to be non-zero. This operation does not
need to be constant-time.Source§fn invert_scalars(scalars: &mut [Self::Scalar])
fn invert_scalars(scalars: &mut [Self::Scalar])
Inverts scalars in a batch. This operation does not need to be constant-time. Read more
Source§fn serialize_scalar(scalar: &Self::Scalar, buffer: &mut [u8])
fn serialize_scalar(scalar: &Self::Scalar, buffer: &mut [u8])
Serializes the scalar into the provided
buffer
, which is guaranteed to have length
Self::SCALAR_SIZE
.Source§fn deserialize_scalar(buffer: &[u8]) -> Option<Self::Scalar>
fn deserialize_scalar(buffer: &[u8]) -> Option<Self::Scalar>
Deserializes the scalar from
buffer
, which is guaranteed to have length
Self::SCALAR_SIZE
. This method returns None
if the buffer
does not correspond to a representation of a valid scalar.impl Copy for Ristretto
impl Eq for Ristretto
impl StructuralPartialEq for Ristretto
Auto Trait Implementations§
impl Freeze for Ristretto
impl RefUnwindSafe for Ristretto
impl Send for Ristretto
impl Sync for Ristretto
impl Unpin for Ristretto
impl UnwindSafe for Ristretto
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)