ecdsa-revealing-the-private-key-from-four-signed-message-two-keys-and-shared-nonces

asked 2023-02-21 15:44:13 +0200

Miroslaw gravatar image

updated 2024-04-12 20:06:15 +0200

FrédéricC gravatar image

I have prepared 4 transactions for 2 pubkeys with the same r1 and r2. The curve is secp256k1.

properties curve secp256k1:

p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f      # prime

n = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141   # order of curve

E = EllipticCurve(GF(p), [0, 7])

G = E.point( (0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798,0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8))   # Base point

It is according to: ecdsa-revealing-the-private-key-from-four-signed-message-two-keys-and-shared-nonces- link here: https://billatnapier.medium.com/ecdsa...

It should work, but it doesn't.

I put transactions, nonces and privatekeys

Why I can't value private1 and private2? - only value 0?

It gives me value 0: please help

privkey1= 74151126465914553719682701372546590912032713247110001383204298192577238294259
privkey2= 65602009300807068992382438511465994464148703102269145684254988072233619429415

nonce1= 113430668354305125354139681412571553637810109882549088741100884487402919060793
nonce2= 88941376982568942091029320764989550225390065895384871037015643141890275775717


#transaction from first privkey1

r1= 37172049453198803628923372374682424137153412099188977901809252086397375163174
s1= 36665125934301679295764426496089959157670212057714313825462899262019004181013
z1= 45063904364969322573281122086971579379876583577391310824950725157431863085693

r2= 40974080779974461932858835766108658066940207003253964846620894290420102383124
s2= 88414683103569280491867470526894992004240909646745888824999991880846576153983
z2= 96925863066810859394685400246217607442326685412593308871569663983290139782035

##transaction from second privkey2

r1= 37172049453198803628923372374682424137153412099188977901809252086397375163174
s3= 48387795993880540164497955151292140905876432678370698441361372722465054520609
z3= 70890957235815785946608014568730757332857823983374044998781188028671033610413

r2= 40974080779974461932858835766108658066940207003253964846620894290420102383124
s4= 94479523762013111191490500533227932711756342618388816229238677867942525385058
z4= 88400657509035765824159536685234267382896518494653799783594906135509259195161

How to calculate, the above privatekey? if I use link : https://crypto.stackexchange.com/ques...

I got result 0 for privkey1 and privkey2.

where is problem?

for another example everything works fine. but in above version is problem.

edit retag flag offensive close merge delete

Comments

Can you elaborate what "should work" and how "it doesn't"?

Max Alekseyev gravatar imageMax Alekseyev ( 2023-02-22 04:44:27 +0200 )edit