How to calculate Z from R and S?

2 replies 437 views
cobra2013Senior Member
Posts: 308 · Reputation: 1912
#1Mar 14, 2022, 11:55 PM
Calculating Z from R and S examples: So here's the thing: R = 0xcabc3692f1f7ba75a8572dc5d270b35bcc00650534f6e5ecd6338e55355454d5 S = 0xf65bfc44435a91814c142a3b8ee288a9183e6a3f012b84545d1fe334ccfac25e # We want the Z value for 0x9b076ad2fe6b2ce63acf4edf7fc82d5152d3c8bffb36b944da7a1cce038f544a Then, R = 0xcabc3692f1f7ba75a8572dc5d270b35bcc00650534f6e5ecd6338e55355454d5 S = 0x9cae782a191f3e742d9d4ff8f726d097a3a256af9fbc1faf16e7ec4d9fcf6feb # Target Z value for 0x85e43d48a83d8713a0fe253bf6b1fc70b8ee780e54749dc500f2880b056c4383 Now check this set: R = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 S = 0xb0fc6f098d906534447438c18cd892ab2fea7b5a24b7715f46a2ece08cd281de # Target Z value for 0x373e088a93b3a987eed3d62bbe5187a42d4e7e7ef6e94885ecb06b8575da6a46 And this one: R = 0xc6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5 S = 0x70b862a9bd712fbc70e5a30152f7951f1b46d40087b83d4330ed4eb6f39d640c # Target Z value for 0x5567c62af707649e8140c5257a6e308c384d6850a4daa172ca54e887fe8fcb8f
6 Reply Quote Share
mike777Member
Posts: 44 · Reputation: 242
#2Mar 15, 2022, 01:26 AM
Are these signed from the same private key d? If you only have one pair of r and s, then you definitely can't compute z.  If you have two pairs, and k_1=k_2=k as I see from your first and second example, then you still cannot compute z_1 and z_2.  From these equations, you only know r, s_1 and s_2.  You could determine d, if you had z and k, because it would be two unknowns (k, d) and two equations.  But, right now, you have four unknowns (k, d, z_1, z_2) and only two equations.  I don't see how you can solve it.
3 Reply Quote Share
dave42Member
Posts: 20 · Reputation: 248
#3Mar 15, 2022, 03:02 AM
k   = (inv(s) * ( z + r * pvk ) ) % N s   = (inv(k) * ( z + r * pvk)  ) % N pvk = (inv(r) *  ( (k*s)-z )    ) % N r * pvk = (  (k*s)-z )  % N r , s , z, private Key , k    All may be odd or even numbers
2 Reply Quote Share

Related topics