Cryptography: The Science of Secure Communication
1. Introduction to Cryptography
Cryptography is the science of encoding and decoding messages to protect information from
unauthorized access. It ensures confidentiality, integrity, authentication, and non-repudiation of
data in communication systems.
2. Goals of Cryptography
The four primary goals are:
1. Confidentiality – keeping data secret.
2. Integrity – ensuring data is not altered.
3. Authentication – verifying the identity of users.
4. Non-repudiation – preventing denial of sent messages.
3. Types of Cryptography
A. Symmetric-Key Cryptography
• The same key is used for both encryption and decryption.
• Example: Caesar Cipher, AES (Advanced Encryption Standard)
• Advantage: Faster
• Disadvantage: Key distribution is a challenge
B. Asymmetric-Key Cryptography
• Uses a pair of keys: public key for encryption and private key for decryption.
• Example: RSA (Rivest–Shamir–Adleman)
• Advantage: Secure key exchange
• Disadvantage: Slower than symmetric
4. Classical Cryptography
A. Caesar Cipher
• A substitution cipher where each letter in the plaintext is shifted a fixed number of places.
• Example: Shift by 3
Plaintext: HELLO
Ciphertext: KHOOR
B. Vigenère Cipher
• A method using a keyword to shift letters by varying amounts.
• More secure than Caesar Cipher
5. Modern Cryptography
Modern cryptography relies on mathematical algorithms and is used in digital communication.
• AES, DES – Symmetric
• RSA, ECC – Asymmetric
• Hashing – SHA-256, MD5
6. Cryptographic Algorithms and Examples
A. RSA Algorithm
Steps:
1. Choose two large primes: p and q
2. Compute n = p × q
3. Compute φ(n) = (p-1)(q-1)
4. Choose e such that 1 < e < φ(n), and e is coprime to φ(n)
5. Determine d such that e × d ≡ 1 (mod φ(n))
6. Public key: (e, n), Private key: (d, n)
B. Example (Simple RSA)
Let p = 3, q = 11, n = 33
φ(n) = 20, choose e = 3, then d = 7
Public key: (3, 33), Private key: (7, 33)
Encrypting message M = 4: C = M^e mod n = 4^3 mod 33 = 64 mod 33 = 31
Decrypt: C^d mod n = 31^7 mod 33 = 4
7. Applications of Cryptography
• Online banking
• Secure email
• E-commerce
• Digital signatures
• Virtual Private Networks (VPNs)
• Blockchain and cryptocurrencies
8. Practice Exercises
A. Encrypt the word 'MATH' using Caesar cipher with a shift of 2.
B. Using RSA, encrypt and decrypt the message M = 5 with p = 5, q = 7, and e = 3.
C. Find the modular inverse of 3 mod 10.