<blockquote>
  <p>How is "P" calculated?</p>
</blockquote>

<p>P is one of the parameters for the secp256k1 curve as defined in <a href="http://www.secg.org/sec2-v2.pdf" rel="nofollow noreferrer">http://www.secg.org/sec2-v2.pdf</a>.</p>

<blockquote>
  <p>Which calculator/script is used to calculate z1*s2, in here ((z1*s2 - z2*s1)/(r*(s1-s2))) and so on????</p>
</blockquote>

<p>Any calculator you want. They are just integers (albeit large integers) so you can use anything that can do large integer computations.</p>

CC BY-SA 4.0
2018-05-13T00:11:54.480Z
Nope, these are integers modulo the group size. The division requires computing a modular inverse.
Pieter Wuille
CC BY-SA 4.0
2018-05-14T06:55:49.160Z
Please explain how you did it and how you got 'P' above. Thanks....
Bill
CC BY-SA 4.0
2018-05-14T15:24:04.513Z
As I said in my answer, P is defined by the secp256k1 curve which is defined in the pdf I linked.
Ava Chow
CC BY-SA 4.0
2018-05-13T00:02:24.990Z
2018-05-13T00:02:24.990Z
Ava Chow
<p>Given:</p>

<pre><code>p  = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
r  = 0xd47ce4c025c35ec440bc81d99834a624875161a26bf56ef7fdc0f5d52f843ad1
s1 = 0x44e1ff2dfd8102cf7a47c21d5c9fd5701610d04953c6836596b4fe9dd2f53e3e
s2 = 0x9a5f1c75e461d7ceb1cf3cab9013eb2dc85b6d0da8c3c6e27e3a5a5b3faa5bab
z1 = 0xc0e2d0a89a348de88fda08211c70d1d7e52ccef2eb9459911bf977d587784c6e
z2 = 0x17b0f41c8c337ac1e18c98759e83a8cccbc368dd9d89e5f03cb633c265fd0ddc
</code></pre>

<p>How is "P" calculated?
Which calculator/script is used to calculate z1*s2, in here ((z1*s2 - z2*s1)/(r*(s1-s2))) and so on????</p>

<p>Thanks so much, I will appreciate your clarification.</p>

CC BY-SA 4.0
2018-05-12T23:56:10.657Z
I've edited your question to remove the all-caps text. Could you please provide more context?
Murch
CC BY-SA 4.0
2018-05-13T00:03:22.343Z
This is the algorithm to determine the the secret key from two signatures with the same nonce.
Pieter Wuille
CC BY-SA 4.0
2018-05-13T15:39:41.667Z
And the data is from https://bitcoin.stackexchange.com/questions/35848/recovering-private-key-when-someone-uses-the-same-k-twice-in-ecdsa-signatures which gives Python and Ruby examples.
dave_thompson_085
CC BY-SA 4.0
2018-05-14T06:58:30.657Z
I tired to run the python script from bitcoin.stackexchange.com/questions/35848/… on https://ideone.com/ but I keep getting a syntax error, please where did I go wrong. The example there is not actually working....
Bill
CC BY-SA 4.0
2018-05-14T09:02:45.290Z
the example is working fine if you select Python instead of Python 3
Mike D
<private-key><signature>
How are P and ((z1*s2 - z2*s1)/(r*(s1-s2))) calculated?
Bill
# How are P and ((z1*s2 - z2*s1)/(r*(s1-s2))) calculated?

(Asked by: username_0 on 2018-05-12)

Given:
p  = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
r  = 0xd47ce4c025c35ec440bc81d99834a624875161a26bf56ef7fdc0f5d52f843ad1
s1 = 0x44e1ff2dfd8102cf7a47c21d5c9fd5701610d04953c6836596b4fe9dd2f53e3e
s2 = 0x9a5f1c75e461d7ceb1cf3cab9013eb2dc85b6d0da8c3c6e27e3a5a5b3faa5bab
z1 = 0xc0e2d0a89a348de88fda08211c70d1d7e52ccef2eb9459911bf977d587784c6e
z2 = 0x17b0f41c8c337ac1e18c98759e83a8cccbc368dd9d89e5f03cb633c265fd0ddc

How is "P" calculated?
Which calculator/script is used to calculate z1*s2, in here ((z1*s2 - z2*s1)/(r*(s1-s2))) and so on????
Thanks so much, I will appreciate your clarification.

**Tags:** private-key, signature

> **Comments:**
> **username_1**: I've edited your question to remove the all-caps text. Could you please provide more context?  
> **username_2**: This is the algorithm to determine the the secret key from two signatures with the same nonce.  
> **username_3**: And the data is from https://bitcoin.stackexchange.com/questions/35848/recovering-private-key-when-someone-uses-the-same-k-twice-in-ecdsa-signatures which gives Python and Ruby examples.  
> **username_0**: I tired to run the python script from bitcoin.stackexchange.com/questions/35848/… on https://ideone.com/ but I keep getting a syntax error, please where did I go wrong. The example there is not actually working....  
> **username_4**: the example is working fine if you select Python instead of Python 3  

---

## 1 answers

### Answer by username_5 on 2018-05-13. Score: 1

> How is "P" calculated?

P is one of the parameters for the secp256k1 curve as defined in <http://www.secg.org/sec2-v2.pdf>.

> Which calculator/script is used to calculate z1\*s2, in here ((z1\*s2 - z2\*s1)/(r\*(s1-s2))) and so on????

Any calculator you want. They are just integers (albeit large integers) so you can use anything that can do large integer computations.

> **Comments:**
> **username_2**: Nope, these are integers modulo the group size. The division requires computing a modular inverse.  
> **username_0**: Please explain how you did it and how you got 'P' above. Thanks....  
> **username_5**: As I said in my answer, P is defined by the secp256k1 curve which is defined in the pdf I linked.  

---

