Assignment 3 - The Mathematics of Cryptography
Assignment 3 - The Mathematics of Cryptography
1. Prime Numbers and Modular Arithmetic: Cryptographic algorithms often use prime
numbers and modular arithmetic. For example, the RSA algorithm, one of the most
widely used public-key cryptosystems, uses the product of two large prime numbers
to generate a public and private key pair.
The RSA algorithm works as follows:
○ Choose two large primes, ppp and qqq.
○ Compute n=p×qn = p \times qn=p×q, which is used as part of the public key.
○ Calculate Euler’s totient function ϕ(n)=(p−1)(q−1)\phi(n) = (p-1)(q-
1)ϕ(n)=(p−1)(q−1).
○ Choose a public exponent eee such that 1<e<ϕ(n)1 < e < \phi(n)1<e<ϕ(n) and
eee is coprime to ϕ(n)\phi(n)ϕ(n).
○ Find the private exponent ddd such that d×e≡1 (mod ϕ(n))d \times
e \equiv 1 \ (\text{mod} \ \phi(n))d×e≡1 (mod ϕ(n)).
○ The public key is (e,n)(e, n)(e,n) and the private key is (d,n)(d, n)(d,n).
2. Elliptic Curve Cryptography (ECC): ECC uses the algebraic structure of elliptic
curves over finite fields. Elliptic curves provide higher security with shorter key
lengths compared to RSA. For example, ECC can achieve the same level of security
as RSA with a 256-bit key rather than a 3072-bit key, making it more efficient for
mobile devices and low-bandwidth environments.
3. Diffie-Hellman Key Exchange: The Diffie-Hellman protocol allows two parties to
securely exchange cryptographic keys over a public channel. It relies on the difficulty
of solving discrete logarithms, which is based on modular exponentiation.
Applications: