<p>I  addition to Claris' answer, if your question is about ECDSA, the hashing step is actually an essential part of the signature scheme and not just a step we choose to do before invoking it. Without it, the signature would not be secure. This is because given a public key, it is possible to compute (signature, message hash) pairs such that the signature is valid for the given public key and computed message hash. However, the message hash won't be the hash of a known message then, and thus making ECDSA verifiers redo the hashing is sufficient to prevent this attack.</p>

CC BY-SA 4.0
2021-12-04T14:19:11.993Z
2021-12-04T14:44:35.877Z
2021-12-04T14:44:35.877Z
Pieter Wuille
<p>Hashing ensures we get a constant length input for the signature operation.</p>

CC BY-SA 4.0
2021-12-04T13:31:53.883Z
2021-12-04T14:09:31.257Z
2021-12-04T14:09:31.257Z
Claris
<p>why is a hash needed for digital signatures? isn't it redundant since the point of hashing is to ensure contents are not tampered with , which the digital signature can do as well (on top of ensuring txn comes from the person)</p>

<transactions><hash><multi-signature><message-signing>
why do we need to hash before we use a private key to digitally sign a transaction? isn't just using a private key enough?
DCH
# why do we need to hash before we use a private key to digitally sign a transaction? isn't just using a private key enough?

(Asked by: username_0 on 2021-12-04)

why is a hash needed for digital signatures? isn't it redundant since the point of hashing is to ensure contents are not tampered with , which the digital signature can do as well (on top of ensuring txn comes from the person)

**Tags:** transactions, hash, multi-signature, message-signing


---

## 2 answers

### Answer by username_1 on 2021-12-04. Score: 4

I addition to username_2' answer, if your question is about ECDSA, the hashing step is actually an essential part of the signature scheme and not just a step we choose to do before invoking it. Without it, the signature would not be secure. This is because given a public key, it is possible to compute (signature, message hash) pairs such that the signature is valid for the given public key and computed message hash. However, the message hash won't be the hash of a known message then, and thus making ECDSA verifiers redo the hashing is sufficient to prevent this attack.


---

### Answer by username_2 on 2021-12-04. Score: 2

Hashing ensures we get a constant length input for the signature operation.


---

