<p>If by <code>z</code> you mean the hash of the message, then yes, <code>z</code> is required to compute <code>s</code>. Therefore, strictly speaking, you need to compute it before <code>s</code>, but not necessarily before <code>r</code>.</p>
<p><a href="https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm</a></p>

CC BY-SA 4.0
2023-05-23T13:49:14.717Z
2023-05-24T00:48:48.617Z
2023-05-24T00:48:48.617Z
sr_gi
<p>I just want to confirm my understanding of signatures for P2PKH transactions.</p>
<p>The signature hash, <code>z</code>, is generated before generating the <code>r</code> and <code>s</code> values of a DER signature, correct?</p>

<signature><ecdsa><sighash>
Is the Z value generated before the (r, s) values?
jiamijiang
# Is the Z value generated before the (r, s) values?

(Asked by: username_0 on 2023-05-23)

I just want to confirm my understanding of signatures for P2PKH transactions.

The signature hash, `z`, is generated before generating the `r` and `s` values of a DER signature, correct?

**Tags:** signature, ecdsa, sighash


---

## 1 answers

### Answer by username_1 on 2023-05-23. Score: 5 | Accepted answer

If by `z` you mean the hash of the message, then yes, `z` is required to compute `s`. Therefore, strictly speaking, you need to compute it before `s`, but not necessarily before `r`.

<https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm>


---

