secp256k1

The private public-verification SIMD field uses exact paired-limb Karatsuba multiplication and a separately specialized schoolbook square with bounded pre-scaled limbs. A compile-time choice shares the carry/reduction code; there is no runtime arithmetic selector. Polynomial and interval checks cover both paths. This matters on the IC: fewer products can still cost more after reconstruction, as the field optimization experiment shows. Secret signing/key-agreement arithmetic is separate and unchanged.

The hinted individual Schnorr path prepares a fresh key table per call using a shared denominator, avoiding its field inversion, and checks both Jacobian coordinates against the validated nonce point. The selected G10 prefix fits the same single-call generator region as G8. The latest qualification compares actual single updates with four-lane and denser independent verification.

The wide public-generator experiment compares fresh-key packed-Q verification with default G windows 8/10/12 and isolated optional G14. It includes all input checks and Q preparation in the call and uses a reproducible interleaved public table. The existing signing path and fixed-generator secret table are unchanged.

This CDK-independent, no_std crate exposes strict ECDSA and BIP340 signing, public-key construction, parsing and verification. It allocates no heap memory; the caller owns output buffers, optional contexts and bounded batch workspace. No IC calls, entropy source, mutable global cache or persistent representation is part of the algorithm API.

verify_fresh_simd4_batch_prehash_with_hints checks independent ECDSA equations in groups of four using the existing Wasm SIMD128 instruction set. It shares the public radix-26 field with the batch crate's Schnorr MSM. The current field retains paired-wide carries. The Schnorr point layer combines indexed gather/scatter, finite-mask fast paths and density-gated checked Z=1 addition, with public-only radix-32 GLV preparation. These are public verification paths; signing and secret arithmetic retain their established constant-time implementation. Raw validation, inverse/hint checks, full-width coefficients and full failure handling retain their respective API contracts. Fresh derived tables and workspace are rebuilt in the call, without a retained key or result cache. In optimized Wasm64 builds, validated affine coordinates are normalized before their read-only radix-26 limbs are copied into public scratch; other backends retain canonical byte conversion. A negative first bucket entry negates its single public Y coordinate directly. Existing point formulas, hint checks and secret arithmetic are unchanged. See carry, marshalling, finite lanes, affine pairs and the current measured choices for architecture and qualification. The dated best-pick report records the selected artifact, validation and workload boundaries.

ECDSA uses exactly 32 prehashed bytes, canonical 33/65-byte compressed/uncompressed SEC1 keys and compact 64-byte r || s signatures. Signature scalars must satisfy 1 <= r,s < n. Infinity, hybrid encodings, raw coordinates, invalid curve points and noncanonical coordinates are rejected. Malformed input returns Error; a well-formed incorrect signature returns Ok(false).

LowSPolicy is mandatory on ordinary ECDSA verifiers. RequireLowS rejects high-S without normalizing it; AllowHighS accepts either mathematical S sign. Signing uses deterministic RFC6979/HMAC-SHA256 with explicit bits2octets reduction and returns low-S. Replay identity must come from the signed application message, not malleable signature bytes.

EcdsaPublicKey retains one validated point. PreparedEcdsaPublicKey holds eight canonical odd multiples in a private 512-byte table; only the validated factory can construct it. The separate NativePreparedEcdsaPublicKey candidate retains sixteen private native affine points, including endomorphism images, and borrows them directly without decoding or rebuilding a table during verification. It uses more retained bytes; table_bytes() reports the actual target-dependent size. The canonical 512-byte path remains the default prepared-table control. BIP340 has separate parsed/canonical-prepared/native-prepared key types created by the even-Y x-only lift. NativePreparedSchnorrPublicKey uses the same opaque sixteen-affine-point table and performs the complete identity/parity/X check. There is no arbitrary table importer, secret exporter, raw memory serializer or cross-algorithm prepared-handle cast.

SchnorrSigningKey retains the normalized secret and matching public key for constant-time signing. EcdsaSigningKey retains the validated secret without an unused public-key cache. These secret contexts do not implement Debug or Clone; inherited RustCrypto drop zeroization remains in place. Caller-owned secret input copies and machine registers are outside that erasure guarantee. BIP340 auxiliary randomness is an explicit 32-byte argument; messages may be empty or any caller-bounded length.

Public verification variants include GLV/wNAF with an immutable generator table, the unchanged constant-time GLV/affine comparison control, a checked inverse hint, three public inversion backends, and exact independent ECDSA verification sharing one scalar inversion. BatchWorkspace<N> bounds all batch scratch at compile time. Every signature equation is checked; this is not randomized batch acceptance. Malformed batches return the offending index before writing any verdict. Empty batches succeed; caller output after the batch remains untouched.

An imported inverse hint is only a canonical candidate. Both direct and prepared verification check s*w == 1 on every use. The standard signature and low-S policy remain unchanged. Wire protocols must account for the extra 32 hint bytes.

verify_fresh_batch_prehash_with_hints accepts raw keys, digests, ordinary signatures and inverse hints together in one call. It parses every SEC1 key and checks every scalar/hint before building fresh native tables in the caller's FreshEcdsaWorkspace<N>. One field inversion normalizes all seven nontrivial odd multiples per key; Q itself was already affine. The resulting eight odd points and their beta images feed independent Native/Jacobian/Window8 equations. No key lookup or result cache exists, and reusing the allocation repeats every validation and preparation. storage_bytes() includes all table/projective/ prefix/equation scratch. Malformed input returns BatchError before writing any verdict; such an aborted cohort is not N completed verifications. Well-formed false equations do not stop other equations. Empty input and output suffixes follow the existing exact-batch contract.

Two explicit pipeline experiments preserve that contract: verify_prehash_with_hint_decode_once parses native scalars once and checks low-S directly; verify_prehash_with_hint_pipeline also writes signed wNAF digits directly into their final scratch rows. They retain no signature or result cache, and the ordinary native method remains the matched control. Native correctness checks do not establish an IC performance improvement.

Fresh-key pipeline candidates accept raw SEC1 keys, prehashes, compact signatures and inverse hints in one call. They include point validation and any native Q-table construction at use, and combine the checked scalar decoder with the public Jacobian/width-eight candidates. Their cohort fixtures retain raw bytes, so key preparation is part of measured verification.

The experimental module has separate nonstandard encodings:

  • InverseEncodedSignature: r32 || w32, where w=s^-1 mod n. It accepts either mathematical S sign; low-S checking requires conversion back to normal ECDSA.
  • ExplicitRSignature: compressed R33 || s32, checking sR=zG+rQ, with r=x(R) mod n and explicit low-S policy. R receives full SEC1 validation. Its 65 bytes are not a compact or recoverable ECDSA encoding.

PreparedSchnorrChallenge retains the SHA256 state after the fixed 64-byte BIP340 challenge-tag prefix. It includes the correct byte count and clones that public state for each verification, saving one compression per challenge. Only the canonical tag can construct it; no arbitrary SHA midstate importer is exposed. One immutable context may be shared across all keys. Direct, canonical table and native-table verifiers offer separate verify_with_challenge methods; ordinary verification remains a same-artifact control. The native ECDSA verifier also exposes an explicit inversion backend for combined native/safegcd trials; its default remains the existing Stein inverse.

Probabilistic BIP340/explicit-R aggregate verification and SIMD Pippenger live in the separate batch crate. The independent ECDSA SIMD entry point checks every equation and does not use aggregate acceptance.

The separate fresh Q-window experiment compares Q widths three through six with G fixed at eight. Its typed caller workspaces share one field inversion across fresh keys, preserve all raw-key/scalar/hint validation and measure the table-preparation/addition tradeoff. The existing packed-width-five control remains unchanged.

NativePreparedEcdsaPublicKey::verify_prehash_with_hint_jacobian is a separate public-arithmetic experiment with the same compact signature, checked inverse hint, validation order and explicit low-S policy as the native control. It uses a private Jacobian accumulator with exceptional-case branches and an inversion-free X/Z² comparison. Complete homogeneous arithmetic, secret signing, field kernels, GLV decomposition, wNAF recoding and prepared tables are unchanged. The independently authored EFD formula implementation is a candidate for measurement, not an independently audited cryptographic implementation.

verify_prehash_with_hint_jacobian_window8 adds a separately measurable generator-only width-eight wNAF window to that accumulator. It uses a frozen shared table of 128 native affine points: 64 odd G multiples and their beta images. The per-key table remains sixteen points; table_bytes() reports that per-key storage and excludes shared static constants. Wider public lookups are variable-time and never enter signing. The reproducible generator checks curve membership, generator order and the beta/lambda relation before writing canonical coordinates. An optimized public MSM and transcript-derived nonzero coefficients need their own qualification before those experiments can be offered safely.

All variable-time operations consume public keys, public digests and public signatures/scalars. Never use them for secret multiplication, nonce inversion, ECDH or private tweaks. Key construction and signing use the existing constant-time RustCrypto arithmetic and fixed-generator selection paths.

The imported k256 0.13.4 tree comes from Showtime's reviewed plugin port; its original checksums remain in PROVENANCE.json. The combined integration patch records the factory-only native table, public Jacobian/window-eight candidates, pipeline scratch, caller-owned constant pool and nested workspace removal. Baseline and secret arithmetic bodies remain independent controls; dependencies, features and package identity remain pinned. Its coordinate field uses upstream 10x26 on wasm64; scalar arithmetic retains the upstream target-dependent limb choice. GLV, wNAF, fixed tables, inversion-free final comparison and BIP340 boundary corrections are described in the vendor record. These homogeneous coordinates represent x=X/Z, so final ECDSA checks use X=rZ or (r+n)Z with strict field-boundary checks.

PackedFreshEcdsaWorkspace and verify_fresh_packed_batch_prehash_with_hints provide the same fresh batch-Q algorithm and exact input/output contract using phase-overlapping projective/native row storage. The caller still rebuilds all keys in the same call. Its smaller scratch trades against possible row copies; native parity alone does not establish an IC instruction or page saving. See the fresh heap record.

NativeEcdsaVerificationConstants owns only immutable G16, identity and GLV constants. verify_prehash_with_hint_and_constants borrows one shared pool while performing all input/range, inverse-relation and low-S checks on each request. The benchmark's seven hinted cohort variants share the same keys, raw records, pool allocation, outputs and complete N-record loop. Ordinary cohorts cover one key with distinct signatures or many keys; explicit tuple cohorts revalidate one repeated tuple N times. Original scalar variants remain diagnostics. No candidate changes the default. See the integration record.

Safegcd uses independently pinned crypto-bigint 0.6.1 through canonical scalar bytes; no new inversion formula is authored here. The constant-time exponent chain and existing Stein inverse are separate controls. Current upstream releases differ from these exact pins; no latest-version claim is made.

PROVENANCE.json pins imported sources, integrated vendor bytes and vector hashes. NOTICES.md records licenses. Crate-local tests cover eight RFC6979/digest-boundary vectors, all 19 pinned official BIP340 vectors, 306 independently generated Python integer-oracle ECDSA cases, low/high-S policy, hint rejection, batch corruption and recovery, inversion boundaries, experimental-format round trips, and native/midstate BIP340 parity over SHA padding boundaries and interleaved malformed signatures. The wNAF carry and sign tests run in the k256 fork, which owns the private recoders. Tests must be run before claiming qualification. See the research notes for measurement scope and remaining optimization hypotheses.