Remove nonstandard 27 minimum value from ecdsa signature v

Ethereum uses 27/28 (superseded) or 35/36 for the v value. Other use
cases may want the recovery value directly. This makes it produce 0/1.
This commit is contained in:
Fang 2018-09-04 14:59:35 +02:00
parent abd6329725
commit b2365dbd4b

View File

@ -4188,7 +4188,7 @@
=+ [r y]=(jc-mul g k)
=/ s (pro.n `@`(inv.n k) `@`(sum.n z (mul r prv)))
=/ big-s (gte (mul 2 s) ^n)
:* v=(add 27 (mix (end 0 1 y) ?:(big-s 1 0)))
:* v=(mix (end 0 1 y) ?:(big-s 1 0))
r=r
s=?.(big-s s (sub ^n s))
==