Skip to main content
IoT
PSUT Engineering StudioPrincess Sumaya University for Technology
V21.6.5 · Student / connected
Cyber Defense StudioIoT Security and PrivacyExperimentsWorkspaces
Home / IoT Security and Privacy / EC02
IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
ESSENTIAL LABORATORY · EC02 · IoT SECURITY AND PRIVACY
IoT Security and Privacy

Historical ciphers II — Playfair, Vigenère, Autokey and frequency analysis

Encrypt and decrypt paired messages using four classical ciphers and analyze their statistical weaknesses.

Design experiment & verify evidence →
EC02 · Laboratory mentorAsk about the current experiment, its algorithms or Python notebook.
Ask Dr. MohammadAdaptive practice
EC02 · Academic orientation

Scope and objectives

Scope of the experiment

Encrypt and decrypt paired messages using four classical ciphers and analyze their statistical weaknesses.

The focus of this experiment is to trace Playfair digraph preparation and polyalphabetic key streams. Students then calculate encryption and inverse operations with explicit conventions, and compare frequency evidence and explain why historical ciphers are not secure. The Concepts view explains the operation before the practical work; the Simulation view is used to examine reference and changed inputs, not to substitute for actual measurements.

Learning objectives

  • Trace Playfair digraph preparation and polyalphabetic key streams.
  • Calculate encryption and inverse operations with explicit conventions.
  • Compare frequency evidence and explain why historical ciphers are not secure.
  • Record the relevant inputs, intermediate states and final verification result before changing the reference configuration.
  • Compare the reference calculation or decision with an independent implementation or authorized observation; state any discrepancy and the applicable model boundary.

Expected learning outcomes

On completion, students can trace Playfair digraph preparation and polyalphabetic key streams, calculate encryption and inverse operations with explicit conventions, and compare frequency evidence and explain why historical ciphers are not secure.

Required deliverables

Submit the derivation or state trace for the named operation, the exact reference and changed configurations, the associated simulator or practical evidence, and a short validation statement addressing compare frequency evidence and explain why historical ciphers are not secure. Separate predicted values from observations.

Prerequisite knowledge and related learning

Review the foundational terminology in Concepts and confirm readiness using the existing setup instructions. After completion, continue to Modular arithmetic I — Congruences and residues.

Environment and experimental methodology

The included teaching workstation and the listed Python/Colab or WSL implementation. Historical and small-number constructions are instructional, not deployment recommendations.

Begin with a manual prediction, record the baseline, change one independent condition at a time, and compare the resulting trace or measurements with the original prediction. Record observations and uncertainty separately from reference values. Follow the experiment’s specific procedure, safety limits, and acceptance checks.

How to investigate Historical ciphers II — Playfair, Vigenère, Autokey and frequency analysis

Encrypt and decrypt paired messages using four classical ciphers and analyze their statistical weaknesses.

Analytical investigation means collecting an observation, identifying the mechanism, using a calculation or state trace to explain it, and checking your conclusion against evidence. Controlled comparison means changing one independent variable, holding the remaining relevant conditions constant, and measuring a dependent variable against a baseline. Experimental validation means comparing a predicted result to a reproducible observation or assertion; agreement inside a model does not certify hardware. Evidence-based reasoning connects a specific observation to a theoretical rule and states uncertainty, not merely an opinion. Performance characterization records a named metric and its units across conditions; sensitivity analysis changes one parameter across several values. A threat assessment links an asset, threat, consequence and evidence to a mitigation.

Experiment-specific guided practice

Objective: Encrypt and decrypt paired messages using four classical ciphers and analyze their statistical weaknesses.

  1. Complete the analytical preparation below before programming. Show the intermediate mathematical calculations.
  2. Playfair digraphs and peer exchange — complete its numbered steps and record the requested evidence.
  3. Monoalphabetic substitution, Vigenère and Autokey — complete its numbered steps and record the requested evidence.
  4. Classical ciphertext analysis — complete its numbered steps and record the requested evidence.

Reference check: Valid Playfair output round-trips to the prepared digraph text; Vigenère, Autokey and monoalphabetic substitution recover normalized plaintext with the correct key.

Model boundary: Fictional educational inputs. Browser algorithms and reference programs; no hardware or live-network measurements. Supplied starter notebooks may be incomplete; trace playback is recorded execution, not arbitrary Python running in browser.

Independent task and submission evidence

2. Playfair digraphs and peer exchange — complete its numbered steps and record the requested evidence. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat.

Before execution write the independent variable and its levels, dependent observation with units where applicable, baseline, controlled variables, measurement method and expected result. For a state machine use state/event/output rather than inventing a numeric metric. Record failures and repeat the baseline. A weak conclusion is “it works”; a supported conclusion names the changed setting, observed value/state, corresponding rule and one limitation.

TrialChanged settingFixed settingsPredicted resultActual observation / unitsEvidence / uncertainty
A: baselineReferenceRecordPredictRecordRecord
B: one changeRecordSame as APredictRecordRecord
A: repeatRestoreSame as APredictRecordRecord

Completion: submit the filled table, relevant simulator screenshot or terminal/notebook output, reasoning with units/assumptions, and one limitation. Preserve the independent assessment questions; this guide does not fill their answers.

Scientific concepts and engineering principles

Scientific architecture · EC02 · Historical ciphers II — Playfair, Vigenère, Autokey and frequency analysis

Playfair geometry and polyalphabetic ciphers — Keyword / POTATO, remove duplicates; 5 × 5 key square / merge I/J; Digraph / same row, column or rectangle; Vigenère / add key letters modulo 26; Cryptanalysis / frequency & repeated n-grams
Scientific concept map: Keyword — Playfair matrix / Vigenère; Plaintext — Digraphs or letters; Transformation — Row / column / shift; Ciphertext — Frequency and n-grams; Analysis — Inverse / key recovery.

Digraph substitution

Playfair fills a 5×5 square with unique keyword letters followed by unused letters, merging I/J. Split the normalized text into pairs, inserting a filler between repeated letters and at the end if required. For encryption shift along the same row or column, or use the opposite rectangle corners. Reverse the shifts for decryption.

Repeating and adaptive key streams

Vigenère adds key-letter indices modulo 26. Autokey starts from the keyword and extends it with plaintext rather than repeating the keyword. Decryption reconstructs the stream incrementally. A fixed substitution maps equal symbols identically; a position-dependent stream does not necessarily do so.

Quantitative cryptanalysis

Calculate symbol counts and relative frequencies, then compare repeated n-grams and their spacings. A candidate substitution must remain bijective and explain the entire message. For Vigenère, estimate period from repeated spacings and compare each residue class of positions. Perform these analyses only on the supplied classroom ciphertext data.

Prerequisites: EC01 and earlier foundations as applicable.

EC02 engineering diagram
Algorithm structure and data flow. Use the simulation to inspect the corresponding numerical transformations.

Engineering diagrams

A varying key produces varying shifts.
A varying key produces varying shifts.

Scientific foundations and worked examples

Playfair geometry and normalization

Construct the square by deleting repeated keyword letters, merging I/J, then appending unused letters. BALLOON yields rows BALON, CDEFG, HIKMP, QRSTU, VWXYZ. With this square the pair ME lies in a rectangle and maps to KF. Compute by coordinates: M is row 2 column 3 and E is row 1 column 2 (zero-based); the exchanged corners are K and F. Same-row pairs shift right and same-column pairs down; decryption reverses these shifts. Split repeated letters using an agreed filler and document whether the original I/J distinction can be recovered.

Monoalphabetic, Vigenère and Autokey

A monoalphabetic substitution preserves the counts of symbols up to relabeling. Vigenère adds a repeated key index to each plaintext index modulo 26. For HELLO and BUCK the repeated key stream is BUCKB, yielding IYNVP. Autokey appends the plaintext to the initial key, so the stream BUCKH yields IYNVV. During decryption recovered plaintext extends the key stream; errors can propagate to later positions.

Frequency, n-grams and known plaintext

The count of a letter divided by the total letter count gives its relative frequency. Compare these counts with the language model; frequent bigrams and trigrams add context when spaces are removed. For a repeating key, distances between repeated ciphertext groups can suggest a common period through their factors. A candidate key length is then tested by splitting the ciphertext into position classes. In a known-plaintext Autokey exercise, subtract aligned known plaintext indices from ciphertext indices modulo 26 to infer the corresponding key-stream positions. Confirm a candidate by re-encryption.

Engineering principles · additional worked teaching example

Vigenère applies cyclic key letters as modular shifts; with plaintext HI and key BC (1,2), H→I and I→K. Playfair uses digraph transformations and a 5×5 grid; its padding and I/J convention must be specified. Autokey extends key using message symbols, not merely repetition.

From theory to experiment

Predict the reference result before operating the workbench; check the actual intermediate state, units and constraints. The existing simulation, implementation and procedure below are distinct sources of evidence.

Worked engineering reasoning and boundary conditions

Vigenère adds successive key indices modulo 26; Playfair operates on pairs of letters using a 5×5 square. A repeated Vigenère key has a period and may expose structure. Example: AB + BC = BD.

Use the diagram to follow the calculation or state progression. Keep the teaching configuration separate from the independent exercise values; compare observations with the actual model and implementation.

Concept animation · operation pathway

Explore the teaching example independently of the simulator. Each step reveals an operation, data relationship or calculated state. The Simulation view has separate editable inputs.

Historical ciphers II — Playfair, Vigenère, Autokey and frequency analysis: operation pathwayPlaintext indicesA B = 0,1Key indicesB C = 1,2Add modulo 261,3 → BDSubtract key0,1 → ABRead the active operation, then inspect the accumulated state.

Step 1 of 4 · Plaintext indices

Plaintext indices

Plaintext indices
A B = 0,1

Teaching example only; inspect live calculations or real practical evidence separately.

Interactive flashcards

Self-rated study progress is stored locally, not used for official grades.

Browse all explanations
How does Playfair process text?

Pairs of letters use a keyed matrix and row, column or rectangle rules.

How does Vigenère differ from Caesar?

It varies shifts using a repeating key.

What does Autokey change?

It extends the key with message-derived characters.

What does Kasiski estimate?

Repeating-key period from repeated ciphertext distances.

Why is a Playfair key matrix 5 by 5?

It represents 25 symbols, usually combining I and J.

What happens to duplicate key letters?

Keep the first occurrence and skip repeats.

What is a Playfair digraph?

A pair of plaintext letters processed together.

How are letters in the same row encrypted?

Move each one right, wrapping around.

How are letters in the same column encrypted?

Move each one down, wrapping around.

How is a rectangle digraph encrypted?

Keep each row and exchange the columns.

Why use filler letters?

To separate repeated letters in a pair and complete an odd-length message.

How does Autokey extend the key?

It extends an initial secret with plaintext symbols.

What does Kasiski analysis use?

Distances between repeated ciphertext fragments to suggest key lengths.

A Playfair pair lies in the same row. What is its encryption rule?

Replace each symbol with its neighbor to the right, wrapping at the row boundary. Use the agreed preprocessing convention.

A Vigenère key repeats every five symbols. What feature can repeated ciphertext n-grams suggest?

Distances between repeated n-grams may be multiples of the period; they are clues, not proof. Compare several distances and candidate periods.

Why does repeated-letter preprocessing matter for Playfair?

A pair of identical letters needs a filler under the chosen convention. The decryptor must interpret fillers consistently.

Shared research workbenches · network designer & advanced studies
Concurrent-device simulation & Monte Carlo research
Distributed digital twin · topology, protocol & battery research