Skip to main content

Crate miden_precompiles

Crate miden_precompiles 

Source

Structs§

CurveCoefficient
A fixed curve coefficient uint pinned at a VM-owned store pointer.
CurvePrecompile
Precompile for point operations over the fixed supported curves.
HashAssertNode
A structural view of a hash assertion node owned by HashPrecompile.
HashPrecompile
A hash assertion precompile parameterized by its HashFunction.
K1Base
Marker type for the secp256k1 base field.
K1Scalar
Marker type for the secp256k1 scalar field.
U256
Marker for arithmetic modulo 2^256.
UintPrecompile
Precompile for 256-bit arithmetic over fixed uint domains.

Enums§

CurveId
Fixed curves supported by the native curve precompile.
CurveNodeRef
Structural view of a curve precompile node.
CurvePoint
Curve-generic point value.
UintDomain
Fixed uint arithmetic domains supported by the native uint precompile.
UintNodeRef
Structural view of a uint precompile node.

Constants§

K1_A_PTR
VM-owned store pointer for the secp256k1 curve coefficient A.
K1_BASE_BOUND_PTR
VM-owned store pointer for the secp256k1 base-field bound (p - 1).
K1_B_PTR
VM-owned store pointer for the secp256k1 curve coefficient B.
K1_GROUP_PTR
VM-owned store pointer for the secp256k1 group configuration.
K1_SCALAR_BOUND_PTR
VM-owned store pointer for the secp256k1 scalar-field bound (n - 1).
ONE_LIMBS
The canonical one value in every supported uint domain.
SECP256K1_BETA
secp256k1 GLV base-field constant β (β³ ≡ 1 mod p, p the base field modulus): φ(x, y) = (β·x mod p, y).
SECP256K1_GENERATOR_X
Standard secp256k1 generator x-coordinate, little-endian u32 limbs.
SECP256K1_GENERATOR_Y
Standard secp256k1 generator y-coordinate, little-endian u32 limbs.
SECP256K1_ID
Stable local curve selector for secp256k1.
SECP256K1_LAMBDA
secp256k1 GLV endomorphism scalar λ (λ³ ≡ 1 mod n, n the curve order): φ(P) = λ·P.
TWO_LIMBS
The canonical two value in every supported uint domain.
U256_BOUND_PTR
VM-owned store pointer for the U256 wrapping-domain bound (2^256 - 1).
ZERO_LIMBS
The canonical zero value in every supported uint domain.

Traits§

CurveSpec
Spec for one fixed curve.
HashFunction
The byte-level hash backing a HashPrecompile.
ShortWeierstrassSpec
Short-Weierstrass-specific parameters for curves of the form y^2 = x^3 + A*x + B.
UintSpec
Spec for one fixed uint arithmetic domain.

Functions§

chunks_to_bytes_exact
Unpack exactly expected_chunks u32-packed-LE chunks back to a n_bytes-length byte vector.
curve_coefficients
Returns all fixed curve coefficients in VM pointer order.
glv_decompose
Splits k (implicitly reduced mod n, the secp256k1 scalar-field order) into a signed short pair [(neg_a, mag_a), (neg_b, mag_b)] with k ≡ (±mag_a) + λ·(±mag_b) (mod n), each magnitude bounded well under n — typically close to half its bit-width — by one Babai rounding step against the precomputed short lattice basis (Hankerson–Menezes–Vanstone, Algorithm 3.74).
n_chunks
Number of 8-felt chunks needed to encode n_bytes of u32-packed input.
phi_generator
The secp256k1 GLV endomorphism image of the generator, φ(G) = (β·G_x mod p, G_y) — a test vector for cross-checking an in-circuit φ(G) computation (e.g. intro_endo’s value relation) against this independent host-side derivation.
registry
Returns a PrecompileRegistry containing the precompiles provided by this crate.
scalar_mul_mod_n
Computes a * b mod n, the secp256k1 scalar-field order.

Type Aliases§

Keccak256Precompile
The Keccak-256 precompile, installed by registry.
Limbs
Little-endian 256-bit value represented as eight u32 limbs.