Ecdsa.verify_rs: def of bend-collections@1.0.0.0 Import: import bend-collections@1.0.0.0/src/crypto/secp256k1/ecdsa.bend as Ecdsa Lines 179-184 of bend-collections@1.0.0.0/src/crypto/secp256k1/ecdsa.bend: https://jend.leeeet.dev/read.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/ecdsa.bend&start_line=179&end_line=184 import Base import bend-collections@1.0.0.0/src/crypto/secp256k1/scalar.bend as S import bend-collections@1.0.0.0/src/crypto/secp256k1/point.bend as P # u1 = z w, u2 = r w with w = s^-1; R = [u1] G + [u2] Q must not be the # point at infinity and x(R) mod n must be r def verify_rs(+q: P.Point, +z: List<&2, Nat>, +r: List<&2, Nat>, +s: List<&2, Nat>) -> Bool: +w = S.inv(s) +rr = P.add(P.mul(S.mul(z, w), P.g()), P.mul(S.mul(r, w), q)) Bool.and(Bool.not(P.is_inf(rr)), S.eq(S.reduce(P.aff_x(P.to_affine(rr))), r)) Uses (16): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.not https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/point.bend&name=Point https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/point.bend&name=add https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/point.bend&name=aff_x https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/point.bend&name=g https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/point.bend&name=is_inf https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/point.bend&name=mul https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/point.bend&name=to_affine https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/scalar.bend&name=eq https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/scalar.bend&name=inv https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/scalar.bend&name=mul https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/crypto/secp256k1/scalar.bend&name=reduce