libsodium_crypto_scalarmult_ristretto255 (libsodium v3.0.1)
View SourcePoint multiplication in the Ristretto255 prime-order group, for building custom protocols.
Elements are bytes/0 byte encodings and scalars are scalarbytes/0 bytes
(little-endian, not clamped). Unlike Ed25519, every valid encoding
represents an element of a prime-order group, so there are no small-order
points to reject.
Both functions return -1 when the input element is invalid or when the
result is the identity element (for example with a zero scalar).
Mod = libsodium_crypto_scalarmult_ristretto255,
A = libsodium_randombytes:buf(Mod:scalarbytes()),
B = libsodium_randombytes:buf(Mod:scalarbytes()),
PA = Mod:base(A),
PB = Mod:base(B),
Shared = Mod:crypto_scalarmult_ristretto255(A, PB),
Shared = Mod:crypto_scalarmult_ristretto255(B, PA).
Summary
Types
A crypto_scalarmult_ristretto255_SCALARBYTES (32-byte) binary.
A crypto_scalarmult_ristretto255_BYTES (32-byte) binary.
A crypto_scalarmult_ristretto255_BYTES (32-byte) binary.
Functions
Multiply the generator by the scalar N. Returns -1 when the result
is the identity.
Return crypto_scalarmult_ristretto255_bytes(), in bytes.
Multiply the element P by the scalar N. Returns -1 when P is
not a valid encoding or when the result is the identity.
Return crypto_scalarmult_ristretto255_scalarbytes(), in bytes.
Types
Functions
Multiply the generator by the scalar N. Returns -1 when the result
is the identity.
-spec bytes() -> Result when Result :: 32.
Return crypto_scalarmult_ristretto255_bytes(), in bytes.
Multiply the element P by the scalar N. Returns -1 when P is
not a valid encoding or when the result is the identity.
-spec scalarbytes() -> Result when Result :: 32.
Return crypto_scalarmult_ristretto255_scalarbytes(), in bytes.