Skip to main content
Cryptography Basics
CHAPTER 01

Introduction to Cryptography

Updated: May 15, 2026
15 min read

# CHAPTER 1

Introduction to Cryptography

1. Introduction

Every time you send a text message, log into your bank, or purchase an item online, you are relying on invisible, complex mathematics to keep your data safe. This mathematical shield is Cryptography. It is the absolute foundation of modern cybersecurity. Without it, the internet as we know it—a platform for global commerce and private communication—would collapse immediately. In this chapter, we will define cryptography, explore its rich history, and introduce the foundational concepts of keeping secrets in a digital world.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Define cryptography and its primary purpose.
  • Understand the historical context of encryption (e.g., the Enigma machine).
  • Define the core concepts of Confidentiality, Integrity, and Non-repudiation.
  • Understand the difference between Cryptography and Cryptanalysis.
  • Recognize modern, everyday applications of cryptography.

3. Beginner-Friendly Explanation

Imagine sending a physical letter through the mail.
  • Without Cryptography: You write your secret on a postcard. The mail carrier, the sorting facility, and your neighbor can all easily read it before it reaches your friend.
  • With Cryptography: You lock the letter inside an impenetrable steel box. You send the locked box through the mail. Everyone can see the box, but only your friend has the unique key to unlock it and read the letter.

Cryptography is the science of building these digital steel boxes.

4. What is Cryptography?

The word comes from the Greek *kryptos* (hidden) and *graphein* (to write).
  • Cryptography is the practice and study of techniques for secure communication in the presence of adversarial third parties (hackers/spies).
  • Cryptanalysis is the opposite: the study of analyzing and breaking those secure communications (codebreaking).
  • Cryptology is the umbrella term encompassing both.

5. The Core Pillars of Cryptography

Cryptography exists to enforce the CIA Triad, plus one extra concept:
  1. 1. Confidentiality: Scrambling data so only authorized people can read it. (Encryption).
  1. 2. Integrity: Ensuring the data has not been altered in transit. If an attacker changes "$10" to "$100", the receiver will know immediately. (Hashing).
  1. 3. Availability: (Cryptography does not directly solve this, but secure systems must remain available).
  1. 4. Non-repudiation: Proving mathematically that a specific person sent a specific message, and they cannot later deny sending it. (Digital Signatures).

6. A Brief History

Cryptography is not new.
  • Julius Caesar used a simple shift cipher to send military commands over 2,000 years ago.
  • During WWII, the Germans used the Enigma Machine, a complex electromechanical rotor cipher. Allied cryptanalysts, led by Alan Turing, broke the Enigma code, an achievement historians estimate shortened the war by two years.
  • Modern cryptography relies on immense computational power and Prime Factorization mathematics, moving far beyond simple letter substitution.

7. Mini Project: Create a Simple Caesar Cipher Demo

Let's conceptualize the oldest encryption method.

The Caesar Cipher Logic: Choose a "Key" (a number, let's say 3). Shift every letter of your message forward by 3 places in the alphabet.

  • Plaintext: HELLO
  • Shift +3: H->K, E->H, L->O, L->O, O->R
  • Ciphertext: KHOOR
If an attacker intercepts KHOOR, it looks like gibberish. The receiver, knowing the Key is 3, simply shifts the letters backward by 3 to read HELLO.

8. Real-World Scenarios

A journalist working in a hostile regime needs to send evidence of corruption to a newspaper in London. If they send an unencrypted email, the local internet service provider (controlled by the regime) will intercept and read it, putting the journalist's life at risk. The journalist uses an encrypted messaging app like Signal. The app encrypts the evidence on the phone. The regime intercepts the data, but because it is cryptographically secured, all they see is millions of random, indecipherable 1s and 0s. The cryptography literally saves the journalist's life.

9. Best Practices

  • Never Roll Your Own Crypto: This is the golden rule of software development. Unless you have a Ph.D. in mathematics, never invent your own encryption algorithm. Always use proven, open-source, mathematically peer-reviewed algorithms (like AES or RSA) that have withstood decades of global attacks.
Cryptography is a dual-use technology. It protects whistleblowers and bank accounts, but it also allows criminals to hide illicit activities and deploy ransomware. In the 1990s, the US government classified strong encryption as "munitions" (weapons) and restricted its export. While these laws have relaxed, debates over "encryption backdoors" for law enforcement remain a complex ethical and legal battlefield.

11. Exercises

  1. 1. Define the concept of "Non-repudiation." Provide a real-world example of why this is necessary in banking.
  1. 2. What is the fundamental difference between Cryptography and Cryptanalysis?

12. FAQs

Q: If math is perfect, why do systems still get hacked? A: The math (the encryption algorithm) is almost never broken. Hackers break the *implementation*. Instead of doing trillions of calculations to break AES-256 encryption, a hacker simply sends a phishing email and tricks the user into handing over the password. The steel box didn't break; the human gave away the key.

13. Interview Questions

  • Q: Describe how cryptography enforces both the Confidentiality and Integrity aspects of the CIA triad.
  • Q: Explain the "Kerckhoffs's Principle." Why is it dangerous to rely on the secrecy of the algorithm itself rather than the secrecy of the key?

14. Summary

In Chapter 1, we defined Cryptography as the mathematical foundation of digital trust. We traced its evolution from ancient military ciphers to modern algorithms protecting global internet traffic. We identified its core purposes: Confidentiality, Integrity, and Non-repudiation. Crucially, we established the first rule of defensive security: we rely on mathematics, not secrecy, and we never attempt to invent our own cryptography.

15. Next Chapter Recommendation

Now that we understand the goal, how does the process actually work? What are Plaintext, Ciphertext, and Keys? Proceed to Chapter 2: Basic Encryption Concepts.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·