Home > Networking > Inside AES Encryption: A Deep Dive into Round 1

Inside AES Encryption: A Deep Dive into Round 1

If you’ve ever wondered how your data stays safe online—think passwords, bank details, or even your late-night chats—AES (Advanced Encryption Standard) is likely the hero behind it. As a symmetric encryption algorithm, AES scrambles your data into unreadable gibberish using a single key. But how does it work under the hood? Let’s zoom into Round 1 of AES-128 (which uses 10 rounds total) and see exactly what happens to your data, step by step, with a real example.

The Setup: Plaintext and Key

Imagine we’re encrypting a 16-byte message: “Hello, world!!!!”. In hex, that’s:

48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 21 20 20

The key? A 16-byte secret: “mysecretkey12345”. AES-128 expands this key into 11 round keys (176 bytes total), but for simplicity, we’ll use a fake Round 1 key: 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10.

Before Round 1, there’s a Round 0 that XORs the plaintext with the first round key. For this post, let’s assume that’s done, and we’re starting with the original bytes (in reality, they’d be slightly scrambled already).

Round 1: The Transformation Begins

AES works on a 16-byte block as a 4×4 grid:

48 65 6c 6c  (H e l l)
6f 2c 20 77  (o ,   w)
6f 72 6c 64  (o r l d)
21 21 20 20  (! !   )

Round 1 has four steps: SubBytes, ShiftRows, MixColumns, and AddRoundKey. Here’s what each does.

Step 1: SubBytes – Swapping Bytes

Every byte gets swapped using a substitution box (S-box), a fixed 256-entry table that adds confusion. For example:

  • 48 (H) → d4
  • 65 (e) → 09
  • 6c (l) → df

After SubBytes, the grid becomes:

d4 09 df df
a4 82 7c f0
a4 8d df ae
5e 5e 7c 7c

Already, “Hello, world!!!!” is unrecognizable!

Step 2: ShiftRows – Sliding Left

Next, we shift each row left to spread the data:

  • Row 0: No shift → d4 09 df df
  • Row 1: Shift left 1 → a4 82 7c f0 becomes 82 7c f0 a4
  • Row 2: Shift left 2 → a4 8d df ae becomes df ae a4 8d
  • Row 3: Shift left 3 → 5e 5e 7c 7c becomes 7c 5e 5e 7c

New grid:

d4 09 df df
82 7c f0 a4
df ae a4 8d
7c 5e 5e 7c

This diffusion ensures a change in one byte affects others.

Step 3: MixColumns – Mixing It Up

Each column is mixed using Galois Field math (fancy matrix multiplication). It’s complex, so here’s a simplified result for Column 1 (d4, 82, df, 7c → e1, 4c, b5, 0d). After all columns:

e1 3b 9a 2f
4c 7d f2 8e
b5 19 6a c3
0d 94 5f 1e

This step spreads the data vertically, making patterns vanish.

Step 4: AddRoundKey – Locking It Down

Finally, we XOR the block with the Round 1 key (01 02 03 04…):

  • e1 ⊕ 01 = e0
  • 3b ⊕ 02 = 39
  • And so on…

Result:

e0 39 99 2b
49 7b f5 86
bc 13 61 cf
00 9a 50 0e

The key ties the encryption to your secret, making it reversible only with “mysecretkey12345”.

After Round 1

From 48 65 6c 6c… to e0 39 99 2b…—in one round, the data’s scrambled. Nine more rounds amplify this chaos, ensuring AES’s legendary security.

Why It Matters

Understanding AES’s rounds is key for white hat hackers. It’s how you secure data—or spot flaws in bad implementations. Want to try it? Install Python’s pycryptodome and encrypt your own message. The code’s simple, but the process? Pure magic.

Leave a Comment