# How are P and ((z1*s2 - z2*s1)/(r*(s1-s2))) calculated?

Given:

``````p  = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
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.

• I've edited your question to remove the all-caps text. Could you please provide more context?
– Murch
May 12, 2018 at 23:56
• This is the algorithm to determine the the secret key from two signatures with the same nonce. May 13, 2018 at 0:03
• And the data is from bitcoin.stackexchange.com/questions/35848/… which gives Python and Ruby examples. May 13, 2018 at 15:39
• I tired to run the python script from bitcoin.stackexchange.com/questions/35848/… on ideone.com but I keep getting a syntax error, please where did I go wrong. The example there is not actually working....
– Bill
May 14, 2018 at 6:58
• the example is working fine if you select Python instead of Python 3 May 14, 2018 at 9:02

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.

• Nope, these are integers modulo the group size. The division requires computing a modular inverse. May 13, 2018 at 0:11
• Please explain how you did it and how you got 'P' above. Thanks....
– Bill
May 14, 2018 at 6:55
• As I said in my answer, P is defined by the secp256k1 curve which is defined in the pdf I linked.
– Ava Chow
May 14, 2018 at 15:24