summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2017-03-07 15:24:48 +0100
committerRahiel Kasim <rahielkasim@gmail.com>2017-03-07 15:24:48 +0100
commit87acdabf12de89da1f79a61610aa4464e1698c61 (patch)
treed013c0e17138fce21444ac705c18506afb5a00b9
parent4b96b938afe1f99da2ccd7df87fc42208ec60bdd (diff)
17: ECDSA Nonce Recovery
-rw-r--r--17-ECDSA-nonce-recovery.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/17-ECDSA-nonce-recovery.py b/17-ECDSA-nonce-recovery.py
new file mode 100644
index 0000000..dae9a6b
--- /dev/null
+++ b/17-ECDSA-nonce-recovery.py
@@ -0,0 +1,16 @@
+from utils import mod_inv
+
+
+z1 = 78963682628359021178354263774457319969002651313568557216154777320971976772376
+s1 = 5416854926380100427833180746305766840425542218870878667299
+r1 = 5568285309948811794296918647045908208072077338037998537885
+
+z2 = 62159883521253885305257821420764054581335542629545274203255594975380151338879
+s2 = 1063435989394679868923901244364688588218477569545628548100
+r2 = 5568285309948811794296918647045908208072077338037998537885
+
+n = 6277101735386680763835789423176059013767194773182842284081
+
+# s_1 - s_2 = k^{-1} (H(m_1) - H(m_2)) mod q
+k = (z1 - z2) * mod_inv(s1 - s2, n) % n
+print(hex(k)[2:])