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 / EC01
IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
ESSENTIAL LABORATORY · EC01 · IoT SECURITY AND PRIVACY
IoT Security and Privacy

Historical ciphers I — Rotation, Caesar and substitution

Implement reversible alphabet rotation, compare Caesar implementations, and analyze the limited key space of classical ciphers.

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

Scope and objectives

Scope of the experiment

Implement reversible alphabet rotation, compare Caesar implementations, and analyze the limited key space of classical ciphers.

The focus of this experiment is to map letters to residues and distinguish rotation from substitution. Students then calculate encoding and inverse decoding under specified mappings, and compare frequency preservation and historical security limitations. 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

  • Map letters to residues and distinguish rotation from substitution.
  • Calculate encoding and inverse decoding under specified mappings.
  • Compare frequency preservation and historical security limitations.
  • 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 map letters to residues and distinguish rotation from substitution, calculate encoding and inverse decoding under specified mappings, and compare frequency preservation and historical security limitations.

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 preservation and historical security limitations. 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 Historical ciphers II — Playfair, Vigenère, Autokey and frequency analysis.

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 I — Rotation, Caesar and substitution

Implement reversible alphabet rotation, compare Caesar implementations, and analyze the limited key space of classical ciphers.

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: Implement reversible alphabet rotation, compare Caesar implementations, and analyze the limited key space of classical ciphers.

  1. Complete the analytical preparation below before programming. Show the intermediate mathematical calculations.
  2. Rotation and alphabet indexing — complete its numbered steps and record the requested evidence.
  3. Four Caesar implementations — complete its numbered steps and record the requested evidence.
  4. Exhaustive Caesar key search — complete its numbered steps and record the requested evidence.

Reference check: A rotation followed by its inverse recovers the original exactly. Every symbol in a substitution key appears once. Caesar brute force enumerates the entire chosen alphabet.

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. Rotation and alphabet indexing — 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 · EC01 · Historical ciphers I — Rotation, Caesar and substitution

Caesar rotation and inverse — Plain alphabet / ABCDEFGHIJKLMNOPQRSTUVWXYZ; Shift / k=3; Plaintext / CAT; Ciphertext / FDW; Inverse / subtract 3 modulo 26
Scientific concept map: Plaintext letters — Alphabet indices; Caesar shift — (x+k) mod 26; Ciphertext — Mapped letters; Inverse shift — (y−k) mod 26; Key search — 26 candidates.

Alphabet as a finite set

Assign each permitted symbol a unique integer from 0 to m−1. With m=28, include lowercase letters, a space and a period. Rotation uses modular wraparound: E(x)=(x+k) mod m; D(y)=(y−k) mod m. The same key and alphabet must be used at both ends.

Equivalent implementations

An index lookup, Python translation table and character-code arithmetic can implement the same mapping. The ASCII approach works directly only for contiguous letters; a custom alphabet needs explicit indexing. Test equality of outputs before comparing runtime.

Key-space experiment

A rotation has m candidate keys. A bijective substitution has m! possible keys, but it preserves single-symbol frequencies. Compare a six-letter permutation space with the 28-symbol space without enumerating the latter. These ciphers are historical teaching mechanisms, not secure IoT encryption.

Prerequisites: None — introductory laboratory.

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

Engineering diagrams

A shift maps each symbol to a new alphabet index.
A shift maps each symbol to a new alphabet index.

Scientific foundations and worked examples

Rotation as a permutation

A finite alphabet is an ordered set, not necessarily a contiguous range of character codes. For the 28-symbol laboratory alphabet, a rotation replaces position i by (i+k) mod 28. The inverse rotation is −k. Composition of two rotations adds their shifts modulo the alphabet length. With the six-symbol alphabet abcdef, a left rotation by 2 produces cdefab. A general substitution instead permits any bijection; it has 28! possible mappings if all 28 symbols participate.

Worked Caesar encryption and decryption

For the ordinary 26-letter alphabet with A=0, the word TEST maps to (19,4,18,19). With k=9 the output indices are (2,13,1,2), giving CNBC. Subtracting 9 modulo 26 restores TEST. With an extended alphabet, always use its exact declared ordering. A space or period must be treated as a symbol, not assumed contiguous with ASCII letters.

Four implementations and key recovery

A direct loop finds each symbol index; a translation table precomputes the mapping; ASCII arithmetic works only for contiguous letters; generalized modular indexing works for any ordered alphabet. These are equivalent under identical normalization and alphabet choices. Exhaustive recovery tries each of the m possible shifts including zero. Recognizable language is evidence of a candidate, not proof of a unique plaintext.

Engineering principles · additional worked teaching example

A Caesar cipher maps letters to integers 0–25, adds a key modulo 26, and subtracts it for decryption. With key 5, Z=25 maps to E=4, since 30 mod26=4; subtracting 5 gives −1 mod26=25. Arbitrary substitution needs a bijection. Neither is modern secure encryption.

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

Caesar maps A=0 through Z=25, C=(P+k) mod 26. A shift preserves relative symbol differences and frequency. Example: Z with k=3 gives 2=C; subtract 3 modulo 26 to recover Z.

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 I — Rotation, Caesar and substitution: operation pathwayAlphabet indexA=0 … Z=25ShiftZ (25) + 3 = 28Reduce28 mod 26 = 2InverseC − 3 ≡ ZRead the active operation, then inspect the accumulated state.

Step 1 of 4 · Alphabet index

Alphabet index

Alphabet index
A=0 … Z=25

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
Why is Caesar weak?

Only 26 shifts including identity; exhaustive search is trivial.

What does rotation preserve?

Character frequency distribution up to relabeling.

How undo shift k?

Subtract k modulo 26.

Why is substitution not modern encryption?

Language statistics leak structure.

Why does the alphabet contain 28 characters?

It includes 26 letters, a space and a period; arithmetic is modulo 28.

What is rotate("abcdef",2)?

cdefab.

How do you undo a Caesar shift of 5?

Apply a shift of −5 modulo the alphabet length.

What happens after a full alphabet rotation?

The original mapping is restored.

What makes a substitution mapping invertible?

Each source character maps to a distinct destination character.

How many shifts exist for an alphabet of 28 symbols?

28 including the identity shift.

Why is exhaustive search feasible for Caesar?

The key space is only the alphabet size.

How many permutations exist for 4 distinct symbols?

4! = 24.

How does translate differ from a character loop?

It applies a precomputed mapping; both must preserve the same alphabet convention.

What should a round-trip test assert?

decrypt(encrypt(message,key),key) equals the message.

A Caesar alphabet has 26 letters. With A=0, encrypt Z using k=3.

Z has index 25. (25+3) mod 26=2, giving C. Inverse subtraction recovers Z.

A substitution map contains two identical output symbols. Is it a valid reversible permutation?

No. Two input symbols map to the same output, so unique decryption is impossible.

Compare brute force for Caesar and arbitrary 26-letter substitution.

Caesar has 26 shifts including zero. Arbitrary substitution has 26! bijections, although language statistics can greatly reduce practical security.

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