Group operations over secp256k1.

Fields

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

Namespaces

Functions

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

Add secp256k1 points.

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

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

fn affineCoordinates(p: Secp256k1) AffineCoordinates

Return affine coordinates.

fn dbl(p: Secp256k1) Secp256k1

Double a secp256k1 point.

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

Return true if both coordinate sets represent the same point.

fn fromAffineCoordinates(p: AffineCoordinates) EncodingError!Secp256k1

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!Secp256k1

Deserialize a SEC1-encoded point.

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

Create a point from serialized affine coordinates.

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

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: Secp256k1, s1_: [32]u8, p2: Secp256k1, s2_: [32]u8, endian: std.builtin.Endian) IdentityElementError!Secp256k1

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: Secp256k1, s_: [32]u8, endian: std.builtin.Endian) IdentityElementError || NonCanonicalError!Secp256k1

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: Secp256k1) Secp256k1

Flip the sign of the X coordinate.

fn random() Secp256k1

Return a random point.

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

Recover the Y coordinate from the X coordinate.

fn rejectIdentity(p: Secp256k1) IdentityElementError!void

Reject the neutral element.

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

Subtract secp256k1 points.

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

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

fn toCompressedSec1(p: Secp256k1) [33]u8

Serialize a point using the compressed SEC-1 format.

fn toUncompressedSec1(p: Secp256k1) [65]u8

Serialize a point using the uncompressed SEC-1 format.

Values

B
type
Fe
undefined

The underlying prime field.

basePoint
Secp256k1

The secp256k1 base point.

identityElement
Secp256k1

The secp256k1 neutral element.