curve25519_scalarmult

  1. ubyte[32] curve25519_scalarmult(in ubyte[] secret, in ubyte[] p = cast(const ubyte[32])publicBasePoint)
    @safe nothrow @nogc
    ubyte[32]
    curve25519_scalarmult
    @safe nothrow @nogc
    (
    in ubyte[] secret
    ,
    in ubyte[] p = cast(const ubyte[32])publicBasePoint
    )
    in { assert (secret.length == 32, "Secret key must be 32 bytes long."); assert (p.length == 32, "Public key must be 32 bytes long."); }
  2. ubyte[32] curve25519_scalarmult(in ref ubyte[32] secret, in ref ubyte[32] p = publicBasePoint)

Parameters

secret
Type: ubyte[]

Your secret key, the 'exponent'.

p
Type: ubyte[]

Receivers public key. Default base point = 9.

Return Value

Type: ubyte[32]

p^secret.

Examples

ubyte[32] publicKey = curve25519_scalarmult(secretKey);

ubyte[32] sharedKey = curve25519_scalarmult(mySecretKey, herPublicKey);

Meta