# Design the Pohlig-Hellman Exponentiation Cipher

Let $n = 7$.

I try something like this:

$$n =p = 7 \rightarrow \phi(n) = 6$$ I chose $d = 17$ and $m = 3$. $$e = d^{-1} \text{ mod } \phi(n) = 17^{-1} \text{ mod } 6 = 5$$ $$17x \text{ mod } 6 = 1$$ $$x = 5$$ What I should doing further ?

• ... forming a more specific question. – Paul Uszak Jun 6 '17 at 22:31
• @Paul Uszak I wonder that i should use C = M^e mid n and M = C^d mod n – Walter White Jun 6 '17 at 22:37
• The P-H cipher is popular today. @WalterWhite, yes, those are the formulas you use. Is there a question beyond that? – user47922 Jun 6 '17 at 23:50
• @galvatron, thats all I woulded to know, thanks, for advice. – Walter White Jun 7 '17 at 8:44
• What is the actual question here? I don't think a question "Am I doing this right, if I use the formulas I got from some source?" is actually useful to anyone else. – tylo Jun 7 '17 at 13:16

For the Pohlig-Hellman cipher, let's say you want to encrypt $M=3$ with $(e,d,p) = (5,17,7)$ as stated in your question. Then you do:
$$C = M^e \text{ mod } n = 3^5 \text{ mod } 7 = 5$$
$$M = C^d \text{ mod } n = 5^{17} \text{ mod } 7 = 3$$,
• Yes. However the example uses $d=17\ge\phi(n)=6$ which is unusual. $d'=d\bmod\phi(n)=17\bmod6=5$ will do just as well as $d=17$. And then we realize the unfortunate coincidence $e=d'$, that is encryption and decryption are the same operation. Conclusion: $n=p=7$ was too small for a valid example; I vote for $n=p=29$, giving $e=d^{-1}\bmod\phi(n)=17^{-1}\bmod28=5$, thus$(e,d,p) = (5,17,29)$, $C = M^e \bmod n = 3^5 \bmod29 = 11$, $M = C^d \bmod n = 11^{17} \bmod29 = 3$. – fgrieu Jun 7 '17 at 13:48