Group operations over P256.

Fields

x: Fe,
y: Fe,
z: Fe = Fe.one,
is_base: bool = false,

Namespaces

Functions

fn add(p: P256, q: P256) P256

Add P256 points.

fn addMixed(p: P256, q: AffineCoordinates) P256

Add P256 points, the second being specified using affine coordinates.

fn affineCoordinates(p: P256) AffineCoordinates

Return affine coordinates.

fn dbl(p: P256) P256

Double a P256 point.

fn equivalent(a: P256, b: P256) bool

Return true if both coordinate sets represent the same point.

fn fromAffineCoordinates(p: AffineCoordinates) EncodingError!P256

Create a point from affine coordinates after checking that they match the curve …

Create a point from affine coordinates after checking that they match the curve equation.

fn fromSec1(s: []const u8) EncodingError || NotSquareError || NonCanonicalError!P256

Deserialize a SEC1-encoded point.

fn fromSerializedAffineCoordinates(xs: [32]u8, ys: [32]u8, endian: std.builtin.Endian) NonCanonicalError || EncodingError!P256

Create a point from serialized affine coordinates.

fn mul(p: P256, s_: [32]u8, endian: std.builtin.Endian) IdentityElementError!P256

Multiply an elliptic curve point by a scalar. Return error.IdentityElement if t…

Multiply an elliptic curve point by a scalar. Return error.IdentityElement if the result is the identity element.

fn mulDoubleBasePublic(p1: P256, s1_: [32]u8, p2: P256, s2_: [32]u8, endian: std.builtin.Endian) IdentityElementError!P256

Double-base multiplication of public parameters - Compute (p1s1)+(p2s2) *IN VA…

Double-base multiplication of public parameters - Compute (p1s1)+(p2s2) IN VARIABLE TIME This can be used for signature verification.

fn mulPublic(p: P256, s_: [32]u8, endian: std.builtin.Endian) IdentityElementError!P256

Multiply an elliptic curve point by a PUBLIC scalar IN VARIABLE TIME This c…

Multiply an elliptic curve point by a PUBLIC scalar IN VARIABLE TIME This can be used for signature verification.

fn neg(p: P256) P256

Flip the sign of the X coordinate.

fn random() P256

Return a random point.

fn recoverY(x: Fe, is_odd: bool) NotSquareError!Fe

Recover the Y coordinate from the X coordinate.

fn rejectIdentity(p: P256) IdentityElementError!void

Reject the neutral element.

fn sub(p: P256, q: P256) P256

Subtract P256 points.

fn subMixed(p: P256, q: AffineCoordinates) P256

Subtract P256 points, the second being specified using affine coordinates.

fn toCompressedSec1(p: P256) [33]u8

Serialize a point using the compressed SEC-1 format.

fn toUncompressedSec1(p: P256) [65]u8

Serialize a point using the uncompressed SEC-1 format.

Values

B
type
Fe
undefined

The underlying prime field.

basePoint
P256

The P256 base point.

identityElement
P256

The P256 neutral element.