scalarMultBase static method

X25519Keypair scalarMultBase(
  1. List<int> scalar
)

Perform scalar multiplication with the base point (u = 9). Returns the X25519 keypair.

Implementation

static X25519Keypair scalarMultBase(List<int> scalar) {
  final BigInt baseU = BigInt.from(9);
  if (scalar.length != Ed25519KeysConst.privKeyByteLen) {
    throw ArgumentException.invalidOperationArguments(
      "scalarMultBase",
      name: "scalar",
      reason: 'Incorrect scalar bytes length.',
    );
  }
  final clamped = _clampScalar(scalar);
  final pk = _montgomeryLadder(clamped, baseU);
  return X25519Keypair._(privateKey: clamped, publicKey: pk);
}