A new year's puzzle:

(We use a toy version of bitcoin in which the group order is 19. So notice that e.g. 1/7 is 7^-1 mod 19 = 11. If you want an easy way to do that, do pow(7, -1, 19) in python.)

Michael makes two Bitcoin transactions using taproot, so the signatures are Schnorr signatures. s_1 = 16 and s_2 = 18.

His transaction hashes (the H(P, R, m) values) were e_1 = 12 and e_2 = 3.

But Michael did something unusual. He used a secret nonce both times (so k_1 and k_2 are secret), but he made it known that each new nonce he uses, he will increment the value by 7.

What is Michael's private key?

#cryptography #bitcoin

Reply to this note

Please Login to reply.

Discussion

Secret nonce you say?

That's why Adam Langley at Google always used to pronounce it "N-once", to the confusion of some Americans :)

Wise, I don't think I could sit in a room with people saying nonce repeatedly without giggling.

Have to come back and try this later today. Thanks for puzzle!

10?

So it should be 9:

x = (s_2-s_1-k_delta) * (e_2-e_1)^-1 mod p

(If I didn't mess up signs)

Nice! I like that you appreciate how the linearity helps to make it a one-liner.

You could explain it more for others if you like :)

Sure. Schnorr signatures take a nonce `k` and a challenge `e` and produce a signature by computing:

s = k + e*a

, where a is the private key of the signer and the number we want to find.

The problem gave 2 signatures, which give a ssytem of linear congruences:

s_1 = k_1 + e_1*a (mod p)

s_2 = k_2 + e_2*a (mod p)

Since we know that the difference between k_2 and k_1 is 7, the system is suddenly determined and we can subtract equation 2 from equation 1:

s_2 - s_1 = k_2 - k_1 + e_2*a - e_1*a (mod p)

Now we know k_2-k_1 so:

s_2 - s_1 = k_delta + e_2*a - e_1*a (mod p)

And solve for a:

a = (s_2-s_1 - k_delta) * (e_2-e_1)^-1 (mod p)

Where ^-1 is the modular inverse.

nostr:nprofile1qqsxwkuyle67y94tj378gw8w2xw2wa6nwmwlqhddlwnz0z7sztsaw2qn2rdgc anotther fun challenge could be cracking the private key when the k are given by a predictable random number generator!

Yeah. That even might be one of the matasano (now cryptopals) challenges. Like Mersenne twister.

A bit much for a "quiz" perhaps. This simple example at least disabuses people of the mistaken belief that it's only nonce *reuse* that's dangerous (although, who that is helping I could not tell you 😁).

This simple quiz really helped me clear up some still-fresh concepts I’ve been studying, so thank you both. More #cryptostr is welcome in my feed :)

Been wondering about this harder version. If it’s simple to state or link, would appreciate it.

I have a vague sense that n+1 txns using a polynomial would likely leak a key, but can’t see how a complex permutation of the scalar field could be cracked without knowing some properties about it. Quick google didn’t yield any results

Thanks for posting. I used similar approach but somehow got formula wrong