Cryptography question I think this is a pohlig hellman symmetric key system working in $\mathbb{Z}/p\mathbb{Z}$
Assuming Alice and Bob both have p (a prime) and k (a key)
If Alice sends $m^k$ to Bob, can Bob raise $m^k$ to $k^{-1}$ to retrieve $m$?
I tried it with $p=7, k=2, k^{-1}= 4$ and $m=3$ but it didnt work:
$(3^2)^4 \equiv 9^4 \equiv 2^4 \equiv 2 \not \equiv 3 \pmod{7}$.
Is there something I did wrong?
 A: Right, it doesn't quite work the way you did it.  This is because you'd want to calculate the inverse of $k$, but not mod $p$.  You'd actually want to look at $\phi(p) = p-1$, and calculate the inverse of $k$, mod $(p-1)$.  (Here $\phi$ is the Euler phi-function.)
Note that in your example, this is actually impossible, since $2$ is not invertible mod $6$ (because $gcd(2, 6) \neq 1$).  This indicates that you shouldn't have chosen the key $k=2$.
So let's try a slightly different example.  Take $p = 17$, so $\phi(p) = 16$, and use the key $k = 11$.  Now if we wish to send the message $m = 2$, we'd encrypt by calculating
$$
2^{11} (\textrm{mod }17),
$$
which is $8$.  So we'd send the cipher-text $8$.
Now, to decrypt the received message, we'll use the inverse of of our key $k=11$, mod 16 (not 17).  We see that $11^{-1} = 3 (\textrm{mod }16)$, since $11 * 3 = 33 = 1 (\textrm{mod }16)$.  So we'll raise $8^3\textrm{mod }17$.  The result is the original message, $m=2$.
Why do we need $k^{-1}$ mod $\phi(p)$ instead of mod $p$?  This is due to Euler's Theorem (or Fermat's Theorem):
$$
a^{\phi(n)} = 1 (\textrm{mod }n)
$$
http://en.wikipedia.org/wiki/Euler%27s_theorem
Therefore if we let $u = k^{-1} (\textrm{mod }\phi(p))$, so that $u*k = 1 (\textrm{mod }\phi(p))$, then:
$$
(m^k)^u = m^{k  u} = (m^{1 + t*\phi(p)}) = (m^{\phi(p)})^t*m^1 = 1^t * m = m (\textrm{mod }p)
$$
This is related to how RSA works.
http://en.wikipedia.org/wiki/RSA_(cryptosystem)
