Function mul [src]
Multiply an elliptic curve point by a scalar.
Return error.IdentityElement if the result is the identity element.
Prototype
pub fn mul(p: P256, s_: [32]u8, endian: std.builtin.Endian) IdentityElementError!P256
Parameters
p: P256
s_: [32]u8
endian: std.builtin.Endian
Possible Errors
Source
pub fn mul(p: P256, s_: [32]u8, endian: std.builtin.Endian) IdentityElementError!P256 {
const s = if (endian == .little) s_ else Fe.orderSwap(s_);
if (p.is_base) {
return pcMul16(&basePointPc, s, false);
}
try p.rejectIdentity();
const pc = precompute(p, 15);
return pcMul16(&pc, s, false);
}