Skip to content

New lesson: AES step by step (real S-box, MixColumns, round keys) - #73

Open
ru44 wants to merge 1 commit into
mainfrom
feat/aes-step-by-step
Open

ru44 wants to merge 1 commit into
mainfrom
feat/aes-step-by-step

Conversation

@ru44

@ru44 ru44 commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Adds a lesson right after "Block ciphers and AES" that shows the real cipher instead of the 16-bit toy.

What students can do

  • Type their own message and key (16 bytes each). The ciphertext after round 10 updates as they type; changing "2026" to "2027" flips 62 of the 128 bits.
  • Pick a round (0–10) and a step (1–4), and click any byte to see how it was made:
    1. SubBytes: the full 16×16 S-box table, with the byte's row and column lit up and the entry it lands on.
    2. ShiftRows: each row's slide drawn, with the selected byte's old and new place.
    3. MixColumns: the fixed 4×4 matrix times the column, with the products worked out (e.g. 2·6b ⊕ 3·1a ⊕ 76 ⊕ 63 = ed) and the ×2 / ×3 rule in words. Round 10 shows that this step is skipped.
    4. AddRoundKey: the round key grid, and the XOR shown bit by bit.

Checks

  • New src/engine/aes.ts is tested against FIPS-197 (S-box values, appendix B round 1 SubBytes and MixColumns, and both example ciphertexts).
  • Lesson text in English and Arabic quotes values computed from the default message and key. Challenges are unsolved at the defaults.
  • Checked in a browser in English (light) and Arabic (dark) at several steps. pnpm check, type-check, lint and build pass.

At phone width the S-box table is too small to read, like the other pictures on small screens.

…atrix and round keys

Students type their own message and key (16 bytes each) and walk through real
AES-128: round 0's XOR with the key, then SubBytes (the 16×16 S-box table with
the byte's row and column lit up), ShiftRows (each row's slide drawn), MixColumns
(the fixed matrix times the column, with the products worked out) and
AddRoundKey (the XOR shown bit by bit). Clicking any byte shows how it was made.
The ciphertext after round 10 updates as they type.

The AES engine is checked against the FIPS-197 examples (appendix B round 1
and both ciphertexts). The lesson comes right after "Block ciphers and AES".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant