🏛️ Chapter 1 — An Introduction to Cryptography

Source: An Introduction to Mathematical Cryptography : Hoffstein, Pipher, Silverman (2nd ed.)
Last updated 2025-04-27


🚩 Navigation


🔤 1.1 Simple Substitution Ciphers

👑 1.1.1 Caesar / shift cipher

Assign letters .

To encrypt a letter of value with key :

To decrypt:

Example (). Number the alphabet . With key , encryption sends

so in letters:


🔀 1.1.2 Mono-alphabetic cipher

A Mono-alphabetic cipher fixes a permutation of the 26 letters. For instance, one choice of is

Since there are possible permutations, the key-space has size


📊 1.1.3 Why statistics leak

English single‑letter frequencies (approx.):

ETAONISRHL
13 %9 %8 %7 %7 %6 %6 %6 %5 %4 %

Bigrams th 17 %, he 13 % dominate. A fixed substitution preserves these peaks, so histograms expose the key.


🛡️ 1.1.4 Defensive evolution

EraTechniqueDefence ideaUltimate weakness
16ᵗʰ c.VigenèreChanging shiftKey length leaks
1920sEnigmaRotor permutation streamOperator mistakes
TodayAES / ChaChaCiphertext indistinguishable from randomOnly brute force

➗ 1.2 Divisibility & GCD

🔢 1.2.1 Toolkit

  • Divisibility
    We say an integer divides an integer , written
    Here, is the quotient, and the absence of remainder is crucial.
    For example, since , but .

  • Greatest Common Divisor (GCD)
    For nonzero integers , the greatest common divisor is the largest positive integer satisfying Equivalently,

  • Bézout’s Identity
    There exist integers (the Bézout coefficients) such that This identity shows is the smallest positive linear combination of and .

  • Modular Inverse
    If , Bézout’s identity yields so is the multiplicative inverse of modulo .


➗ 1.2.2 Euclidean Algorithm (Worked)

The Euclidean algorithm computes via repeated division with remainder.

Example: Compute

Once the remainder is , the last nonzero remainder is

Complexity: Lamé’s theorem (1844) shows the number of division steps is , in fact fewer than times the decimal digits of .


🧮 1.2.3 Extended Euclidean Algorithm

To find Bézout coefficients such that we maintain sequences with

202410
748201
52811−2
2202−13
8823−8
44−719

Thus,


🔄 1.3 Modular Arithmetic

📦 1.3.1 Ring Structure of

  • Residue Classes.
    We denote by the equivalence classes of integers modulo : Addition and multiplication are defined with wrap‑around: where sums and products are reduced modulo to lie in .

  • Examples ().
    The set forms a ring, commonly denoted , with:

    • Additive identity: , since .
    • Multiplicative identity: , since .
    • Additive inverses: .

🧮 1.3.2 Euler’s Theorem and Fermat’s Little Theorem

  • Euler’s Totient Function equals the number of integers in that are coprime to .

  • Euler’s Theorem.
    If , then

  • Fermat’s Little Theorem.
    If is prime and , then and


⚡️ 1.3.3 Efficient Exponentiation

  • Binary Expansion of the Exponent.
    Any exponent admits a binary representation

  • Square‑and‑Multiply Concept.

    1. Precompute successive squares: modulo .
    2. Multiply together those squares corresponding to the 1‑bits of .
    3. Total modular multiplications: about .
  • Illustration.
    To compute : so each obtained via repeated squaring and selected multiplies. This reduces the number of multiplications from (naïve) to roughly squares + multiplies = total.


🔺 1.4 Primes & Finite Fields

🔢 1.4.1 Prime Number

  • Definition.
    An integer is called prime if its only positive divisors are and . Equivalently,

🔍 1.4.2 Generating Primes with the Sieve of Eratosthenes

  • Conceptual Overview.

    1. Start with a list of integers from up to .
    2. Repeatedly mark (“sieve out”) multiples of each prime found, beginning with .
    3. The unmarked numbers that remain are the primes .
  • Example ().

    • Begin: .
    • Mark multiples of : .
    • Next unmarked is , mark its multiples: .
    • Continue up to .
    • Primes found: .
  • Efficiency.

    • Time complexity: .
    • Space: .
    • Generates all primes up to efficiently, and for , runs in well under a second in optimized implementations.

⚗️ 1.4.3 The Finite Field

  • Definition.
    For a prime , the set with addition and multiplication modulo forms a field, denoted .

  • Field Axioms.

    • Additive group: is cyclic of order .
    • Multiplicative group: is cyclic of order .
    • Every nonzero element has a unique inverse satisfying .
  • Computing Inverses (Fermat’s Little Theorem).
    If , then

  • Cryptographic Choice.

    • Modern cryptosystems (e.g. Diffie–Hellman, elliptic curves) pick to achieve roughly 128‑bit security against brute‑force attacks.

⚡ 1.5 Powers & Primitive Roots

🔢 1.5.1 Multiplicative Order

  • Definition.
    For a prime and an integer with , the order of mod , denoted , is the smallest positive integer such that

  • Properties.

    1. divides , since by Fermat’s little theorem .
    2. The powers cycle through a subgroup of of size .

🌱 1.5.2 Primitive Roots (Generators)

  • Primitive Root.
    A primitive root modulo is an element whose order is exactly : Equivalently, the powers produce all nonzero residues in some order.

  • Existence.
    For every prime , there exists at least one primitive root modulo .

    • To find a primitive root , one factors and tests candidates until

📜 1.6 Historical Milestones

A brief overview of landmark ciphers throughout history and the key techniques that led to their cryptanalysis.

YearCipherBreak Highlight
50 BCECaesar ShiftBrute‑force search of 26 shifts
830Arab CryptanalysisFrequency analysis of letters
1553Vigenère CipherIndex of coincidence
1917Zimmermann TelegramExploitation of linguistic patterns
1939Enigma MachineMechanical Bombe‑based search
1944Lorenz CipherColossus computer and statistical methods

🏛️ 50 BCE — Caesar Shift

  • Algorithm: Shift each letter by a fixed offset (typically 3).
  • Cryptanalysis: A brute‑force attempt of all 26 possible shifts quickly reveals the plaintext.
  • Significance: One of the earliest recorded uses of substitution ciphers.

🔍 830 — Arab Cryptanalysis

  • Cryptographer: Al-Kindi (Arab mathematician).
  • Technique: Developed frequency analysis, observing that certain letters appear more often in a language.
  • Impact: Demonstrated that simple substitution ciphers are insecure.

🔒 1553 — Vigenère Cipher

  • Cipher: Polyalphabetic substitution using a repeating keyword.
  • Cryptanalysis: The index of coincidence method by Babbage and later Kasiski reveals the keyword length, reducing it to multiple Caesar ciphers.
  • Legacy: Once called “le chiffre indéchiffrable,” it was eventually broken and paved the way for modern cryptanalysis.

🕵️ 1917 — Zimmermann Telegram

  • Context: World War I diplomatic communication.
  • Attack Method: Analysts used linguistic context and known-plaintext guesses to reconstruct parts of the message.
  • Historical Outcome: Its decryption helped bring the United States into the war.

⚙️ 1939 — Enigma Machine

  • Device: Electro‑mechanical rotor cipher machine used by Germany.
  • Decryption: The Bombe machine, designed by Alan Turing and colleagues at Bletchley Park, automated key search using cribs and known patterns.
  • Effect: Allied forces gained critical intelligence during WWII.

🖥️ 1944 — Lorenz Cipher

  • System: High‑level teleprinter cipher (called “Tunny” by British codebreakers).
  • Breakthrough: The Colossus computer exploited statistical weaknesses and wheel‑pattern analysis.
  • Importance: One of the first large‑scale electronic computers, marking the birth of modern computing.

🔐 1.7 Symmetric vs Asymmetric

🔑 1.7.1 Symmetric Ciphers

  • Definition: Both sender and receiver share the same secret key for encryption and decryption.
  • Characteristics:
    • Very efficient: suitable for encrypting large volumes of data.
    • Key distribution challenge: secure key exchange is required before use.
  • Examples:
    • Block ciphers like AES (Advanced Encryption Standard) operate on fixed-length blocks (e.g. 128 bits).
    • Stream ciphers generate a pseudorandom keystream to XOR with the plaintext.

🌍 1.7.2 Asymmetric Ciphers

  • Definition: Uses a public key for encryption and a private key for decryption.
  • Characteristics:
    • Simplifies key distribution: public key can be openly shared.
    • Computationally heavier: used typically to secure small messages or keys.
  • Examples:
    • RSA (Rivest–Shamir–Adleman).
    • Diffie–Hellman key exchange for establishing shared secrets.
    • Elliptic curve variants (e.g.\ ECDH, ECDSA).

🔄 1.7.3 Hybrid Encryption

  • Concept: Combine strengths of both systems:
    1. Generate a random session key for a fast symmetric cipher.
    2. Encrypt the session key using the recipient’s public key.
    3. Encrypt the bulk data with the symmetric cipher using the session key.
  • Benefit: Achieves both performance and secure key distribution.