secp256k1Mult static method
Secp256k1Gej
secp256k1Mult({
- List<
int> ? scalarBytes, - Secp256k1Scalar? scalar,
- Secp256k1Ge? point,
- List<
int> ? pointBytes, - bool checkScalar = true,
Implementation
static Secp256k1Gej secp256k1Mult({
List<int>? scalarBytes,
Secp256k1Scalar? scalar,
Secp256k1Ge? point,
List<int>? pointBytes,
// Secp256k1ECmultGenContext? context,
bool checkScalar = true,
}) {
if (scalar == null && scalarBytes == null) {
throw ArgumentException.invalidOperationArguments(
"secp256k1Mult",
name: "scalar",
reason: "Missing scalar or scalar bytes.",
);
}
if (point == null && pointBytes == null) {
throw ArgumentException.invalidOperationArguments(
"secp256k1Mult",
name: "point",
reason: "Missing point or point bytes.",
);
}
point ??= loadPublicKey(pointBytes!);
if (point == null) {
throw ArgumentException.invalidOperationArguments(
"secp256k1Mult",
name: "point",
reason: "Invalid point bytes.",
);
}
bool hasScalar = scalar != null;
scalar ??= scalarFromBytes(scalarBytes!);
if (checkScalar && !scCheck(scalar)) {
throw ArgumentException.invalidOperationArguments(
"secp256k1MultBase",
name: "scalar",
reason: "Invalid scalar bytes.",
);
}
Secp256k1Gej R = Secp256k1Gej();
Secp256k1.secp256k1ECmultConst(R, point, scalar);
// Secp256k1Ge mid1 = Secp256k1Ge();
// Secp256k1.secp256k1GeSetGej(mid1, R);
if (!hasScalar) scalar.setZero();
return R;
}