Since I'm doing research in cryptography now, I think it is worthwhile to talk about how number theory is applied in cryptography. One of the basic ideas behind cryptography is the one-way function. One-way function is a function that is easy to compute, but hard to invert. More specifically, $f$ is a one-way function if $f$ can be compute in polynomial time, and for any polynomial-time algorithm $A$, the probability that $A(f(x)) \in f^{-1}(f(x))$ is negligible. Although the existence of the one-way function is unknown, most mathematicians believe that factorization is one of the candidates. Another candidate is the discrete logarithm. An example of the discrete logarithm is the integer x satisfying the congruence equation $a^x \equiv b\ \mbox{mod}\ p$. No one has come up with the efficient algorithm for both factorization and solving discrete logarithms, but they are not proven to be one-way function either. This is the reason why we can do cryptography because mathematicians believe that these problem are hard and there is no polynomial time algorithm (for classical computer) to solve them.

Another application of number theory in cryptography