libsodium_crypto_scalarmult_ed25519 (libsodium v3.0.1)
View SourcePoint multiplication on the Edwards25519 curve, for building custom protocols.
Points are bytes/0 byte encodings and scalars are scalarbytes/0 bytes
(little-endian). crypto_scalarmult_ed25519/2 and base/1 clamp the
scalar like X25519; noclamp/2 and base_noclamp/1 use it as is (reduced
modulo the group order).
These functions return -1 when the input point is invalid or of small
order, or when the result is the identity element (for example with a zero
scalar).
Mod = libsodium_crypto_scalarmult_ed25519,
A = libsodium_randombytes:buf(Mod:scalarbytes()),
B = libsodium_randombytes:buf(Mod:scalarbytes()),
PA = Mod:base(A),
PB = Mod:base(B),
Shared = Mod:crypto_scalarmult_ed25519(A, PB),
Shared = Mod:crypto_scalarmult_ed25519(B, PA).
Summary
Types
A crypto_scalarmult_ed25519_SCALARBYTES (32-byte) binary.
A crypto_scalarmult_ed25519_BYTES (32-byte) binary.
A crypto_scalarmult_ed25519_BYTES (32-byte) binary.
Functions
Multiply the base point by the clamped scalar N. Returns -1 when
N is zero.
Multiply the base point by the scalar N without clamping. Returns
-1 when the result is the identity.
Return crypto_scalarmult_ed25519_bytes(), in bytes.
Multiply the point P by the clamped scalar N. Returns -1 when P
is invalid or of small order, or when the result is the identity.
Multiply the point P by the scalar N without clamping. Returns -1
when P is invalid or of small order, or when the result is the
identity.
Return crypto_scalarmult_ed25519_scalarbytes(), in bytes.
Types
Functions
Multiply the base point by the clamped scalar N. Returns -1 when
N is zero.
Multiply the base point by the scalar N without clamping. Returns
-1 when the result is the identity.
-spec bytes() -> Result when Result :: 32.
Return crypto_scalarmult_ed25519_bytes(), in bytes.
Multiply the point P by the clamped scalar N. Returns -1 when P
is invalid or of small order, or when the result is the identity.
Multiply the point P by the scalar N without clamping. Returns -1
when P is invalid or of small order, or when the result is the
identity.
-spec scalarbytes() -> Result when Result :: 32.
Return crypto_scalarmult_ed25519_scalarbytes(), in bytes.