Diffie-Hellman
Bindings for the crypto_scalarmult API. See the libsodium crypto_scalarmult docs for more information.
Constants
Buffer lengths (integer)
crypto_scalarmult_BYTES
crypto_scalarmult_SCALARBYTES
crypto_scalarmult_base
sodium.crypto_scalarmult_base(q, n)
Creates a scalar multiplication public key based on a secret key.
q
should be abuffer
of lengthcrypto_scalarmult_BYTES
n
should be abuffer
of lengthcrypto_scalarmult_SCALARBYTES
The generated public key is stored in q
.
crypto_scalarmult
sodium.crypto_scalarmult(q, n, p)
Derives a shared secret from a local secret key and a remote public key.
q
should be abuffer
of lengthcrypto_scalarmult_BYTES
n
should be abuffer
of lengthcrypto_scalarmult_SCALARBYTES
p
should be abuffer
of lengthcrypto_scalarmult_BYTES
The generated shared secret is stored in q
.