def recover_x_if

bend-collections@1.0.0.0 · spec/crypto/secp256k1/ecdsa.bend:215

import bend-collections@1.0.0.0/spec/crypto/secp256k1/ecdsa.bend as Ecdsa
import Base
import bend-collections@1.0.0.0/spec/crypto/secp256k1/curve.bend as CV

215# R: the point of x-coordinate x = r + j n (j = id / 2, x < p) whose y has
216# parity id mod 2
217def recover_x_if(+one: Nat, +e: Nat, +r: Nat, +s: Nat, +id: Nat, +x: Nat, ok: Bool) -> Maybe<&2, List<&2, U32>>:
218  match ok:
219    case True{}: recover_r(one, e, r, s, CV.decompress(p(one), x, Nat.mod(id, 2n)))
220    case False{}: None{}

Uses (9)

Used by (1)