<p>Bitcoin uses ECDSA to sign messages. With ECDSA, signing requires as input the private key, the message, and also a random number <em>k</em>. Signing two different messages with the same <em>k</em> allows anyone with both signatures to easily recover your ECDSA private key. So every time you sign something with Bitcoin, a new <em>k</em> is generated, and this makes the signatures different. (The range of <em>k</em> is extremely large, so the chance of accidentally reusing a <em>k</em> when you generate one randomly is too small to seriously consider.)</p>

<p>Some elliptic-curve crypto algorithms specify that <em>k</em> be a hash of the message. This ensures that <em>k</em> is always distinct per message, making it more difficult to screw up when implementing the algorithm. With an algorithm that behaves like this, signing the same message with the same key would always get you the same signature. However, this is not standard for ECDSA, so Bitcoin doesn't do this currently.</p>

CC BY-SA 3.0
2014-07-24T05:22:27.920Z
2014-07-24T05:22:27.920Z
theymos
<p>I just noticed that if you repeatedly sign the same message in bitcoin-qt, the signature changes.</p>

<p>Why is this?</p>

<bitcoin-core><signature>
Why does re-signing a message in bitcoin-qt produce a different hash
spraff
# Why does re-signing a message in bitcoin-qt produce a different hash

(Asked by: username_0 on 2014-07-23)

I just noticed that if you repeatedly sign the same message in bitcoin-qt, the signature changes.

Why is this?

**Tags:** bitcoin-core, signature


---

## 1 answers

### Answer by username_1 on 2014-07-24. Score: 7 | Accepted answer

Bitcoin uses ECDSA to sign messages. With ECDSA, signing requires as input the private key, the message, and also a random number *k*. Signing two different messages with the same *k* allows anyone with both signatures to easily recover your ECDSA private key. So every time you sign something with Bitcoin, a new *k* is generated, and this makes the signatures different. (The range of *k* is extremely large, so the chance of accidentally reusing a *k* when you generate one randomly is too small to seriously consider.)

Some elliptic-curve crypto algorithms specify that *k* be a hash of the message. This ensures that *k* is always distinct per message, making it more difficult to screw up when implementing the algorithm. With an algorithm that behaves like this, signing the same message with the same key would always get you the same signature. However, this is not standard for ECDSA, so Bitcoin doesn't do this currently.


---

