secp256k1MultBase static method
Secp256k1Ge
secp256k1MultBase({
- List<
int> ? scalarBytes, - Secp256k1Scalar? scalar,
- Secp256k1ECmultGenContext? context,
- bool secp = true,
Implementation
static Secp256k1Ge secp256k1MultBase({
List<int>? scalarBytes,
Secp256k1Scalar? scalar,
Secp256k1ECmultGenContext? context,
bool secp = true,
}) {
if (scalar == null && scalarBytes == null) {
throw ArgumentException.invalidOperationArguments(
"secp256k1MultBase",
name: "scalar",
reason: "Missing scalar.",
);
}
bool hasScalar = scalar != null;
bool hasContext = context != null;
scalar ??= scalarFromBytes(scalarBytes!, secp: secp);
context ??= initalizeBlindEcMultContext();
if (secp &&
hasScalar &&
Secp256k1.secp256k1ScalarCheckOverflow(scalar) == 1) {
throw ArgumentException.invalidOperationArguments(
"secp256k1MultBase",
name: "scalar",
reason: "Invalid scalar bytes.",
);
}
Secp256k1Gej R = Secp256k1Gej();
Secp256k1.secp256k1ECmultGen(context, R, scalar);
Secp256k1Ge mid1 = Secp256k1Ge();
Secp256k1.secp256k1GeSetGej(mid1, R);
R.setZero();
if (!hasScalar) scalar.setZero();
if (!hasContext) context.clean();
return mid1;
}