How to calculate mod inverse
up vote
0
down vote
favorite
1
Given a number set of integers $mathbb{Z}$ , how do I find the inverse of a given number? I am trying to test an algorithm to extract the $k$ and $x$ values from the Elgamal Signature algorithm given that $k$ is repeated. What I have is $k$ congruent to $(m_1 - m_2)times(s_1 - s_2)^{-1} mod p - 1$ given $k$ is used twice. I am not sure how to calculate the mod inverse though? _ Is the above formula the same thing as $((m_1 - m_2) mod p -1 times (s_1 - s_2)^{-1} mod p -1) mod p -1$ I am not sure if it is any different since I am doing a mod inverse. PS. I am a programmer, not a mathematician so please elaborate.
number-theory
share | cite | improve this question
...