IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
CRYPTOGRAPHY ENGINEERING · CR13 · AES
IoT Security and Privacy
AES · architecture and column-major state
AES has a fixed 128-bit block (16 bytes).
CR13 · Laboratory mentorAsk about the current operation and its intermediate values.
CR13 · Academic orientation
Scope and objectives
Scope of the experiment
AES is a substitution–permutation network, not a Feistel network. All variants use 128-bit blocks; keys of 128,192,256 bits use 10,12,14 rounds. A byte is eight bits.
The focus of this experiment is to map byte streams into AES column-major state matrices. Students then relate key lengths to round counts and trace initial key addition, and verify state serialization and distinguish a transformation from full encryption. 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 byte streams into AES column-major state matrices.
Relate key lengths to round counts and trace initial key addition.
Verify state serialization and distinguish a transformation from full encryption.
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 byte streams into AES column-major state matrices, relate key lengths to round counts and trace initial key addition, and verify state serialization and distinguish a transformation from full encryption.
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 verify state serialization and distinguish a transformation from full encryption. Separate predicted values from observations.
Prerequisite knowledge and related learning
Use the curriculum sequence and the Concepts section for prerequisite terminology. After completion, continue to AES · SubBytes and inverse S-box.
Environment and experimental methodology
A standard browser and the experiment-specific Python implementation or Colab notebook. Where the practical uses a protocol model, model results are distinguished from actual local cryptographic operations.
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.
01 · Experiment overview
CR13 · AES · architecture and column-major state
AES has a fixed 128-bit block (16 bytes). Place byte i at row i mod 4, column floor(i/4). AES-128/192/256 use 10/12/14 rounds. Initial AddRoundKey precedes standard rounds; final round omits MixColumns. AES is not a Feistel network.
Before starting
Environment: standard computer, browser and Python/WSL.
Simulation: Editable JavaScript calculation
Technical scope: Classroom computation on a standard computer. Educational cipher code is not a production security implementation.
Complete the six stages in order. Use the same experiment inputs when comparing manual, browser and Python results.
02 · Concepts and mathematical foundations
AES has a fixed 128-bit block (16 bytes). Place byte i at row i mod 4, column floor(i/4). AES-128/192/256 use 10/12/14 rounds. Initial AddRoundKey precedes standard rounds; final round omits MixColumns. AES is not a Feistel network.
Learning objectives
Calculate the named operation, inspect its intermediate values, reproduce the result in Python, and explain one controlled change. Prerequisites: binary/hexadecimal arithmetic; complete preceding labs in the same topic where applicable.
Before starting
Environment: standard computer, browser and Python/WSL.
Simulation: Editable JavaScript calculation
Technical scope: Classroom computation on a standard computer. Educational cipher code is not a production security implementation.
AES state and round structure
1 · Principles and purpose
AES is a substitution–permutation network, not a Feistel network. All variants use 128-bit blocks; keys of 128,192,256 bits use 10,12,14 rounds. A byte is eight bits.
2 · Mathematical and algorithmic foundations
S[r,c]=input[4c+r]. Initial AddRoundKey precedes standard rounds (SubBytes, ShiftRows, MixColumns, AddRoundKey); the final round omits MixColumns. Each transformation has an inverse.
3 · Worked teaching example
For serialized bytes 10 11 12 13 20 21 22 23 …, column zero is (10,11,12,13). Row zero starts 10,20. Distinguish serialization from a row-major printed matrix.
Captured earlier local execution. Randomized values and timing can differ; compare the invariant.
4 · Verification and experimental interpretation
Step through the following visualization and compare the named operation with the corresponding computed state. Check the mathematical invariant, inverse operation or protocol acceptance condition. Change one input at a time; distinguish a measured output from a prediction.
Mathematical representation and interpretation
AES state indexing
b_i denotes the serialized block bytes; AES fills columns first. The number of rounds is 10, 12 or 14 for keys of 128, 192 or 256 bits respectively.
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.
Step 1 of 3 · Column-major input
Column-major input
State hex
00112233445566778899AABBCCDDEEFF
Ordering
column-major
Initial round key
State hex
000102030405060708090A0B0C0D0E0F
Ordering
column-major
AddRoundKey
State hex
00102030405060708090A0B0C0D0E0F0
Ordering
column-major
Teaching example only; inspect live calculations or real practical evidence separately.
Shared research workbenches · network designer & advanced studiesConcurrent-device simulation & Monte Carlo research
Verified baseline reference — use the live workstation below to explore steps and compare inputs.
Edit the fields and choose Recompute. Use step controls to inspect real calculated states. Hexadecimal byte fields are written without 0x; numeric fields accept decimal or 0x notation.
Select an algorithm step to view its calculated diagram. The byte inspector uses index 4c+r; in row/column or XOR labs it jumps to the corresponding operation. Matrix values follow the representation selector; arithmetic annotations use hexadecimal. On narrow screens, scroll the diagram horizontally to inspect every label.
Use the baseline inputs shown above. Predict a result, advance one operation at a time, inspect the intermediate state, then change only the parameter specified in the Experiments view. Export the trace and compare it with your manual derivation.
AES has a fixed 128-bit block (16 bytes). Place byte i at row i mod 4, column floor(i/4). AES-128/192/256 use 10/12/14 rounds. Initial AddRoundKey precedes standard rounds; final round omits MixColumns. AES is not a Feistel network.
Predict the baseline result before revealing the calculated state. A controlled comparison changes the named input while keeping the other conditions fixed. Record an observed value separately from an expected value.
Part A · Independent theoretical exercises
Complete each question before running the simulator or Python. Show calculations or protocol traces. The teaching example is a method, not a substitute for the assigned values.
01 · Application and derivation
Application and derivation · Independent work
Load plaintext 00112233445566778899AABBCCDDEEFF into a 4×4 column-major AES state. Write the round counts for the three key lengths and perform initial AddRoundKey using 000102030405060708090A0B0C0D0E0F.
Application and derivation — S[r,c]=input[4c+r]. Initial AddRoundKey precedes standard rounds (SubBytes, ShiftRows, MixColumns, AddRoundKey); the final round omits MixColumns. Each transformation has an inverse. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
02 · Data layout
Data layout · Independent work
In AES column-major loading of bytes 00..0F, identify coordinates of 0x0E and the byte at row1 column3 (zero-based).
Data layout — Review the defining equations and compare the input restrictions and state transitions in Concepts. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
Required evidence: state the expected invariant or acceptance condition; record hand-derived results, compare with the simulator or Python trace, and explain the first discrepancy. Do not report a predicted value as a measurement.
Expanded independent theoretical exercise bank
Progress from calculation and interpretation to diagnosis and controlled engineering design. Complete the questions without opening the simulation first; show intermediate steps.
Intermediate · Alternate configuration
Independent theoretical exercise · CR13-01
For the separate teaching-test configuration plaintext: 00112233445566778899AABBCCDDEEFF; key: 000102030405060708090A0B0C0D0E0F1011121314151617, predict rounds using the relevant operation or decision rule. Show intermediate work and state whether this is a deterministic result.
Intermediate · Interpret a computation state
Independent theoretical exercise · CR13-02
A teaching trace for AES · architecture and column-major state contains step: Initial round key; state: 000102030405060708090A0B0C0D0E0F. Explain the role of state (recorded value 000102030405060708090A0B0C0D0E0F) and identify the rule or input that determines it. Distinguish an intermediate state from the final result.
Advanced · Identify a terminal invariant
Independent theoretical exercise · CR13-03
The first teaching trace contains step: Column-major input; state: 00112233445566778899AABBCCDDEEFF; the last contains step: AddRoundKey; state: 00102030405060708090A0B0C0D0E0F0. Identify one distinction between the initial operation and completion. What additional condition must hold to use the result?
Challenging · Controlled algorithm verification
Independent theoretical exercise · CR13-04
Plan a comparison of plaintext: 00112233445566778899AABBCCDDEEFF; key: 000102030405060708090A0B0C0D0E0F with plaintext: 00112233445566778899AABBCCDDEEFF; key: 000102030405060708090A0B0C0D0E0F1011121314151617. Record the dependent value rounds, identify the changed factor(s), and describe the verification and failure criterion without claiming a real security measurement.
Part B · Guided simulation and practical procedure
Before starting — tools and setup
Standard computer; extract the WSL toolkit into a new directory. For the browser activity, use the integrated workstation. Editable browser calculation
Install Python dependencies only if required by the selected toolkit README. Use its requirements file and virtual environment instructions.
Write a prediction using the worked calculation in Concepts.
Load the baseline plaintext and 16-byte key; write the first two columns in row/column notation. Select step 3 (AddRoundKey), choose byte 6, and calculate the XOR manually.
Export the trace and compare against the reference only after predicting.
Compare your baseline with the verified reference output below; for runtime-dependent results, compare invariants and report actual measurements instead of expecting identical timing or randomly generated values.
Evidence to record
Key length (bytes), Nk, Nr, first round-key bytes, initial state matrix and initial XOR; explain why the first XOR is unchanged.
Part D · Controlled experiment — State loading and key-size comparison
Keep plaintext and the first 16 key bytes fixed. Extend the key by 1011121314151617 for AES-192; then append 18191A1B1C1D1E1F for AES-256. Record the initial XOR and round count for each.
Record the conditions held constant and complete the trial table.
Measure Key length (bytes), Nk, Nr, first round-key bytes, initial state matrix and initial XOR; explain why the first XOR is unchanged. Explain the first differing operation and verify inverse recovery where applicable.
Part E/F · Independent Python verification and deliverables
Download the notebook or toolkit and run the default example.
Reproduce each assigned trial using the notebook or edit a copy of example-input.json and use python3 lab.py --params example-input.json. Compare the browser and Python trace at the same step.
Complete the independent assessment below without copying the worked baseline. Explain discrepancies and distinguish mathematical results from security claims.
Additional investigation instructions
A controlled comparison changes one independent input while holding other inputs fixed, then measures its effect on the dependent output. A baseline is the unmodified run. Evidence-based reasoning means citing the actual observed values, not merely asserting that an algorithm is secure.
Run the supplied default values and record the first and final state.
Predict the effect before changing anything. Change append 1011121314151617 to key; then extend to 32 bytes. First verified alternate: {"key": "000102030405060708090A0B0C0D0E0F1011121314151617"}.
Keep plaintext.
Measure state, first key XOR and round count.
Restore the baseline and repeat with another valid input. Locate the first differing calculation.
Submit a comparison table, a trace JSON or screenshots of relevant steps, and a short conclusion with an explicit limitation.
Trial
Changed input
Fixed conditions
Prediction
Measured value
Reason / limitation
Baseline
None
Default
Student prediction
Record trace
Explain
Trial 1
Specified change
Unchanged inputs
Student prediction
Record trace
Explain
Part C · Python, Google Colab and WSL
The standalone implementation uses the same synthetic baseline and calculations as the browser. In Colab, download the notebook, open Colab and upload it using File → Upload notebook. Run all cells in order.
Use Ubuntu or Kali WSL, not PowerShell. Download the toolkit above to your computer. If Python, venv or unzip is missing, install these prerequisites once (requires administrator permission and network access).
In WSL, enter the actual downloaded ZIP path when prompted (for example, a file under /mnt/c/Users/…/Downloads). Extract to a new, dedicated directory. If this directory already exists from a previous extraction, use the existing verified toolkit or choose a clean directory rather than overwriting it.
Step 1 · Extract · bash
read -r -p "Full path to PSUT_V22_9_9_Cryptography_WSL.zip: " ZIP
DEST="$HOME/psut-crypto-v22.9.9"
if [ -f "$ZIP" ] && [ ! -e "$DEST" ]; then
mkdir "$DEST" && unzip "$ZIP" -d "$DEST"
else
echo "Check ZIP path and use a fresh destination."
fi
Create the isolated environment in the extracted toolkit root, activate it, then enter this experiment’s actual folder. Install only its declared dependencies. A comment-only requirements file requires no third-party packages.
Step 2 · Activate and install · bash
cd ~/psut-crypto-v22.9.9
python3 -m venv .venv
source .venv/bin/activate
cd CR13
ls
python -m pip install -r requirements.txt
Execute the default run and save the genuine program output. Then run the supplied regression test and the baseline fixture through the explicit input interface.
To change inputs, copy example-input.json, edit the copy in a text editor and run the command below. The original fixture is preserved.
Step 4 · Change an input · bash
cp example-input.json my-input.json
# Edit my-input.json with your preferred editor.
python lab.py --params my-input.json
These scripts terminate normally. Use Ctrl+C to stop a long-running calculation if needed. When finished, leave the isolated virtual environment; no global service cleanup is required for these local examples.
Step 5 · Finish · bash
deactivate
Declared dependencies: # Standard library only for core experiment
Expected terminal output — captured local execution
This excerpt contains the actual first trace step and final result from python lab.py, followed by the actual regression test output. Full stdout is in CR13/verified-output.txt inside the toolkit. Timing, random signatures, keys, certificate fields and implementation-dependent sizes can vary; compare the invariant and record your own observations.
Check the output JSON and the test exit status. An assertion error means the expected invariant was not met. If Python reports a missing module, activate the environment and install the experiment’s requirements file; if a file is missing, check pwd and ls.
Why is the initial XOR identical for these three extended keys?
The first 16 bytes of each key are identical.
What is the index of row 3, column 2?
4×2+3=11 (zero-based).
06 · Knowledge assessment
Formative check
Which state cell contains serialized byte index 6?
Responses are for instructor review; no grading key is provided here.
Independent assessment
Load a 24-byte key and plaintext 000102030405060708090A0B0C0D0E0F. Draw the state matrix and first AddRoundKey by hand, then explain the number of remaining rounds. Use an additional valid trial, a calculation or a counterexample to support your reasoning. Submit evidence from both runtimes and explain what the experiment does not establish.
Part F · Engineering evidence record
Record the baseline, prediction, changed input, observed result, discrepancy and limitation. Save locally or export with the displayed result. This is not an official submission.