Expand description
Elliptic curve point operations on short Weierstrass curves y^2 = x^3 + ax + b.
Uses Jacobian projective coordinates (X, Y, Z) where the affine point is (X/Z^2, Y/Z^3). The point at infinity is represented by Z = 0.
Scalar multiplication uses a Montgomery ladder for constant-time execution.
Structs§
- Curve
Params - Parameters for a short Weierstrass curve.
- Jacobian
Point - A point on a short Weierstrass curve in Jacobian projective
coordinates
(X, Y, Z).
Functions§
- brainpoolp256r1_
params - brainpoolP256r1 curve parameters (BSI / RFC 5639 §3.4).
- brainpoolp384r1_
params - brainpoolP384r1 curve parameters (BSI / RFC 5639 §3.6).
- brainpoolp512r1_
params - brainpoolP512r1 curve parameters (BSI / RFC 5639 §3.7).
- double_
scalar_ mul - Compute k1G + k2Q (used in ECDSA verify). Not constant-time in the public values (signature verification is public).
- hex_
to_ fe - Decode a hex string into a
FieldElement<LIMBS>. The hex is interpreted as big-endian and must contain an even number of hex digits. - hex_
to_ limbs - Decode a hex string into a
[u64; LIMBS](used forpandn). Big-endian hex; pads with leading zeros if shorter than LIMBS*8 bytes. - is_
on_ curve - Check whether the affine point
(x, y)lies on the short Weierstrass curvey^2 = x^3 + a*x + bdefined byparams. - p256_
params - NIST P-256 / secp256r1 curve parameters (FIPS 186-4 §D.1.2.3).
- p384_
params - NIST P-384 / secp384r1 curve parameters (FIPS 186-4 §D.1.2.4).
- point_
add - Jacobian point addition:
P + Q. Uses the generic “add-2007-bl” formula (no assumption on Z coordinates). - point_
double - Point doubling in Jacobian coordinates for any short Weierstrass curve
y^2 = x^3 + ax + b. Uses the generic “dbl-2007-bl” formula by Bernstein-Lange
(cost: 2M + 8S + 1a-mul + 10add). Works for arbitrary
a, including a=0 (secp256k1) and the randomaof Brainpool curves. - scalar_
mul_ point - Scalar multiplication using the constant-time Montgomery ladder.
Computes
k * Pfor a scalarkand a non-infinity pointP. - secp256k1_
params - secp256k1 curve parameters (SEC 2 v2.0 §2.4.1).
- secp521r1_
params - secp521r1 / NIST P-521 curve parameters (FIPS 186-4 §D.1.2.5).