implementing modular multiplicative inverse.

150 Views Asked by At

I wish to implement the clifford cocks algorithm using GMP. In the encryption part: $c_1=t_1+at_1^{-1}\bmod n$. Following $( a b \bmod n ) = ((a \bmod n) \cdot (b \bmod n ))\bmod n$, I took the modular multiplicative inverse of $t_1$, multiplied by $(a \bmod n)$ added it to $(t_1 \bmod n)$ and again took the mod. Please someone suggest where am I going wrong. And is there any alternative approach to it?