☕
Pause for minutes until .
Remaining:
Pius Walter
T4INF1202: Kryptologie
Part 1: Security goals and simple ciphers
2026-03-31
Introduction
  • This course will give you the basic tools and mathematical background to understand and judge cryptographic constructions
  • These are essential for cryptographic design and evaluation
  • There is quite a bit of math that comes with the topic
Goals
  • The goal is to get you up to speed so that the further cryptographic courses can build upon that foundation
  • Some of it may be already known from Cyber Security Basics
Goals
  • I'd like to encourage you to:
    • get the infrastructure (get familiar with Linux and tooling required for hacking)
    • code these examples yourself, preferably in Python
    • pay close attention to implementation of low-level bit arithmetic
  • The earlier you start with the aforementioned, the easier your studies will be down the line
Organization
  • Course divided in three parts, one third of Prof. Dr. Hübl, one third Dr. Weigel and one third myself
  • My slides are in English, language of lecture is German
  • Coursework iterates through three lecturers (2 out of 3 every week)
Grading and Finals
  • Labwork is graded and counts 25% towards total grade; 75% of score achieved by final exam
  • You're asked to turn in your coursework in handwritten form
  • Simple calculators (non-graphing) are permitted in the final exam
  • Final exam is scheduled on 2026-06-17 (tentative and subject to change, check MOODLE!)
Repeating labwork
  • In case you fail the course, you will have the option to retain your labwork score (before the exam)
  • Otherwise you will have to write a scientific paper about a topic of our choosing
  • Four weeks time to complete the paper
Feedback wanted!
  • Presentations don't get better by themselves
  • I'm asking for your honest feedback to improve, correct, adjust this
  • At the end, you'll receive a link to the slides (an HTMLHyper Text Markup Language page) which contains a feedback form as the last slide
  • It is totally anonymous (unless you submit your name/email) and I'd really appreciate you taking the time to let me know how I did
Security goals
  • Depending on the definition, there are typically three or four defined security goals
  • Sometimes this is called the “CIA triad”
  • Those security goals are:
    • Confidentiality: protection against eavesdropping
    • Data integrity: protection against accidental/deliberate manipulation
    • Availability: protection against loss of service
    • Non-repudiation: protection against deniability
Security goals
  • When those security goals are met, then:
    • Confidentiality: someone who listens to communication can not make sense of it
    • Data integrity: the recipient of communication can detect if the data has been modified
    • Availability: the service remains reachable and responsive under different load scenarios
    • Non-repudiation: we know a message can only have been authenticated by the sending party
Security goals
  • Confidentiality: typically achieved by encryption
  • Data Integrity: typically achieved by authentication
  • Availability: typically achieved by redundancy
  • Non-repudiation: typically achieved by asymmetric cryptography
Ciphers
Caesar Cipher
13
The Caesar cipher
  • The typical “first” recorded cipher is the Caesar cipher
  • It's allegedly been used by Julius Caesar to protect military secrets with a fixed key
  • Technically, it is a monoalphabetic substitution cipher
  • It still finds modern use as part of ROT13Rotate by 13 Places
The Caesar cipher
  • Core idea of any monoalphabetic substitution cipher: replace every letter of the plaintext by a corresponding ciphertext letter
  • I.e., there exists a mapping function, which maps every plaintext letter to a ciphertext letter
  • Only requirement of this mapping: injectivity (can convert from plaintext to ciphertext and back)
  • In this particular case: bijectivity (essentially a one-to-one mapping)
The Caesar cipher
  • In case of the Caesar cipher, this plaintext ↔ ciphertext letter mapping can be efficiently constructed by use of a simple key
  • This makes its use relatively simple because it decreases the amount of data that comprises a key
The Caesar cipher
  • Encryption is applied to each letter individually by adding a fixed offset (key). This gives for each plaintext character the ciphertext character.
  • Decryption operation is application of the inverse process, subtracting the same offset.
The Caesar cipher
  • For a given plaintext letter Q4mta4Ck5NLHp = [ 0 \ldots 25 ]Zf1qH71g5gJY
  • ...and a given key Q4mta4Ck5NLHk = [ 0 \ldots 25 ]Zf1qH71g5gJY
QBEntEozXWioc = E_k(p) = (p + k) \mod 26kIt7msRdzcHK
QBEntEozXWiop = D_k(c) = (c - k) \mod 26kIt7msRdzcHK
Keys and key space
    • Note that we include the so-called weak key Q4mta4Ck5NLHk = 0Zf1qH71g5gJY as a valid key (even though it is the identity mapping)
    • Therefore, there are 26 different keys that can be used
    • We speak of a key space size is 26 or Q4mta4Ck5NLH\log_2 26 \approx 4.7\ \textnormal{bit}Zf1qH71g5gJY
Brute force
  • Attacking the cipher is fairly easy:
    • Original Caesar construction had fixed Q4mta4Ck5NLHk = 3Zf1qH71g5gJY, making this essentially purely obfuscation
    • Exhaustive key space enumeration is possible
    • The input frequency of characters is entirely preserved. If the plaintext was biased, the output will exhibit the exact same bias.
Example plaintext
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.
Histogram Attack
Histogram Attack
Indistinguishability
  • I.e., full key recovery is trivial if you have a vague idea of the source distribution
  • Good ciphers should never have this property:
    • You should be able to encrypt a virtually arbitrary amount of constant data (e.g. zeros), i.e., data that is heavily biased
    • The encrypted ciphertext should not be distinguishable from random data to an external observer
    • When a cipher has this property, we speak of indistinguishability
The Vigenère cipher
  • The Caesar cipher can be easily improved upon:
  • Slightly more sophisticated is the Vigenère cipher
  • Technically the Vigenère cipher can be viewed as multiple Caesar ciphers with different keys running in a round-robin fashion
The Vigenère cipher
  • For example, with a key Q4mta4Ck5NLHK = [ 1, 10, 20 ] = \textnormal{AJT}Zf1qH71g5gJY:
    • The 1st character is encoded with Q4mta4Ck5NLHk = 1Zf1qH71g5gJY
    • The 2nd character is encoded with Q4mta4Ck5NLHk = 10Zf1qH71g5gJY
    • The 3rd character is encoded with Q4mta4Ck5NLHk = 20Zf1qH71g5gJY
    • The 4th character is encoded with Q4mta4Ck5NLHk = 1Zf1qH71g5gJY
    • ...and so on.
  • The technical term for this is polyalphabetic substitution cipher
The Vigenère cipher
  • The histogram of such a cipher is not straightforward to decipher anymore
  • Obviously, the key needs to be random as well (which for Vigenère ciphers it typically would not be)
Histogram of Vigenère cipher
Frequency analysis
  • The Vigenère cipher can also be attacked by frequency analysis, since the natural language letter frequency is known
  • Therefore, the attacker can conjecture that the most frequent ciphertext character is equivalent to the most frequent character of the language (i.e., “E” in German or English)
  • Guess does not need to be correct, but gives good direction in traversal of key space (from most likely to least likely)
Frequency analysis
  • This does work directly on the given data for the Caesar cipher
  • It does not work on the data produced by the Vigenère cipher anymore, since the key is switched in a round-robin fashion at every character
  • The histogram of a Vigenère cipher is therefore the combination of many “overlaid” Caesar-cipher histograms
Attacking the Vigenère cipher
  • We however can apply a simple trick:
    • We don't know the key length, but we can take a guess.
    • First, the attacker assumes Q4mta4Ck5NLH|K| = 2Zf1qH71g5gJY for the following.
    • Also note that for Q4mta4Ck5NLH|K| = 1Zf1qH71g5gJY, the Vigenère cipher collapses into a Caesar cipher
    • After we make our guess of the key length, we group every nth character and create a histogram from that
Attacking the Vigenère cipher
  • Reducing the data into a smaller subset is called decimation
  • Decimation has typically two corner paramters:
    • Stride: The distance between two elements that are chosen
    • Offset: The starting element
  • Python syntax for list reduction:
    array[begin : end : stride]
Histogram of Vigenère cipher
Histogram of Vigenère cipher
The Vigenère cipher
  • Since there was not much of an improvement, we can assume the guessed key length Q4mta4Ck5NLH|K| = 2Zf1qH71g5gJY was incorrect.
  • We simply re-group the ciphertext data with a new attempt, this time Q4mta4Ck5NLH|K| = 3Zf1qH71g5gJY
  • Again we create histograms based on that grouped data
Histogram of Vigenère cipher
Histogram of Vigenère cipher
Histogram of Vigenère cipher
The Vigenère cipher
  • Note that the problem of attacking the key by use of a known-plaintext attack does not scale exponentially with the key length
  • I.e., instead of increasing the problem proportionally to Q4mta4Ck5NLH26^{|K|}Zf1qH71g5gJY it only scales proportionally with Q4mta4Ck5NLH|K|Zf1qH71g5gJY
Securing the Vigenère cipher
  • Imagine there are two other conditions that are met:
    • Key length and plaintext length are identical
    • Keys are fully randomly generated
    • Keys are never reused for any plaintext
  • This actually makes the cipher not only secure, but perfectly secure
One-time pad
  • The cipher that a Vigenère cipher becomes under these conditions is called the one-time pad
  • It is an informational-theoretically secure cipher – no inference of plaintext can be made from ciphertext
  • Any plaintext may be recovered from any ciphertext of the same length by appropriate choice of key
One-time pad
  • For obvious reasons, one-time pads are incredibly impractical:
    • Key length is impractically long for any non-trivial message
    • Key reuse immediately breaks all security of the system
  • How can we turn this into something modern, usable?
One-time pad
  • The one-time pad can be made practicable by introducing a few drawbacks:
    • We want finite, constant key length (typically not more than 32 bytes), independent of the encrypted data
    • We want to be able to reuse the key with different cryptograms
    • In trade, we waive the requirement of perfect provable secrecy
  • More on this in future lectures
Key space
44
Introduction
  • The key space is just a fancy term for answering: how many different possible keys are there?
  • It applies to both passphrases but symmetric keys as well
  • Its measure is typically given in bit, because that is much easier to handle
  • I.e., instead of saying there are Q4mta4Ck5NLHNZf1qH71g5gJY possible keys, we say the key space is Q4mta4Ck5NLH\log_2 NZf1qH71g5gJY bit
  • Reminder: Q4mta4Ck5NLH\log_2 N = \frac{\ln N}{\ln 2}Zf1qH71g5gJY
Passphrase complexity
  • When dealing with passphrases, we can compute the key space by two factors:
    • Size of the alphabet (i.e., possible choices for each character)
    • Length of the passphrase
  • Example: alphabet size of uppercase and lowercase letters is Q4mta4Ck5NLHa = 26 + 26Zf1qH71g5gJY
Passphrase complexity
  • In typical passphrases, all characters have the same count of choices
  • For an alphabet size Q4mta4Ck5NLHaZf1qH71g5gJY and a passphrase length Q4mta4Ck5NLHlZf1qH71g5gJY the key space simply is Q4mta4Ck5NLHN = a^lZf1qH71g5gJY
Password complexity
  • What is the key space in bits of a random password of 12 characters in which uppercase letters, lowercase letters and digits are permitted for each character?
Password complexity
  • What is the key space in bits of a random password of 12 characters in which uppercase letters, lowercase letters and digits are permitted for each character?
  • Q4mta4Ck5NLHa = 26 + 26 + 10 = 62,\ \ l = 12Zf1qH71g5gJY
  • Q4mta4Ck5NLH\log_2 a^l = \log_2 62^{12} \approx 71.5Zf1qH71g5gJY
Key space usecase
  • For cryptographic purposes, key space is almost always given in bits
  • It gives a nice exponential metric that has an intuitive meaning to it, since it corresponds to strength of ideal ciphers
  • I.e., breaking an ideal Q4mta4Ck5NLHnZf1qH71g5gJY bit cipher requires on average Q4mta4Ck5NLH2^{n-1}Zf1qH71g5gJY attempts (a walk through half the keyspace)
Conclusion
50
Outlook
  • Cryptography and ciphers are intricately linked with the mathematics that make them work
  • You will gain a good understanding of the theory and estimation processes in this course
  • You should be able to derive key spaces from basic statistical observations
Thank you!
Any questions?
Acronyms