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

Why is this?


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.