How Aes Works: A Complete Guide to Understanding This Blockchain Concept

During AES algorithm processing, a 4 x 4 array of bytes known as the state is modified using multiple rounds.

Full encryption requires 10 to 14 rounds, depending on the size of the key.

A Complete Guide to Understanding This Blockchain Concept

The following table shows the key sizes and the required number of rounds: Key size Number of rounds required 128-bit 10 rounds 192-bit 12 rounds 256-bit 14 rounds Once the state is initialized with the input to the cipher, four operations are performed in four stages to encrypt the input.

These stages are: AddRoundKey, SubBytes, ShiftRows, and MixColumns: 1.

In the AddRoundKey step, the state array is XOR’d with a subkey, which is derived from the master key 2.

SubBytes is the substitution step where a lookup table (S-box) is used to replace all bytes of the state array 3.

The ShiftRows step is used to shift each row to the left, except for the first one, in the state array to the left in a cyclic and incremental manner 4.

Finally, all bytes are mixed in the MixColumns step in a linear fashion, column-wise The preceding steps describe one round of AES.

Why This Matters for Blockchain Technology

In the final round (either 10, 12, or 14, depending on the key size), stage 4 is replaced with AddRoundKey to ensure that the first three steps cannot be simply reversed: AES block diagram, showing the first round of AES encryption.

In the last round, the mixing step is not performed Various cryptocurrency wallets use AES encryption to encrypt locally-stored data.

Especially in Bitcoin wallet, AES-256 in the CBC mode is used.

Here’s an OpenSSL example of how to encrypt and decrypt using AES: $ openssl enc -aes-256-cbc -in message.txt -out message.bin enter aes-256-cbc encryption password: Verifying – enter aes-256-cbc encryption password: $ ls -ltr -rw-rw-r– 1 drequinox drequinox 14 Sep 21 05:54 message.txt -rw-rw-r– 1 drequinox drequinox 32 Sep 21 05:57 message.bin $ cat message.bin The following are the contents of the message.bin file: Note that message.bin is a binary file.

Key Points to Remember

  • How AES works During AES algorithm processing, a 4 x 4 array of bytes known as the state is modified using multiple rounds.
  • Full encryption requires 10 to 14 rounds, depending on the size of the key.
  • The following table shows the key sizes and the required number of rounds: Key size Number of rounds required 128-bit 10 rounds 192-bit 12 rounds 256-bit 14 rounds Once the state is initialized with the input to the cipher, four operations are performed in four stages to encrypt the input.
  • These stages are: AddRoundKey, SubBytes, ShiftRows, and MixColumns: 1.

Going Deeper: Advanced Concepts

Sometimes, it is desirable to encode this binary file in a text format for compatibility/interoperability reasons.

The following command can be used to do just that: $ openssl enc -base64 -in message.bin -out message.b64 $ ls -ltr -rw-rw-r– 1 drequinox drequinox 14 Sep 21 05:54 message.txt -rw-rw-r– 1 drequinox drequinox 32 Sep 21 05:57 message.bin -rw-rw-r– 1 drequinox drequinox 45 Sep 21 06:00 message.b64 $ cat message.b64 U2FsdGVkX193uByIcwZf0Z7J1at+4L+Fj8/uzeDAtJE= In order to decrypt an AES-encrypted file, the following commands can be used.

An example of message.bin from a previous example is used: $ openssl enc -d -aes-256-cbc -in message.bin -out message.dec enter aes-256-cbc decryption password: $ ls -ltr -rw-rw-r– 1 drequinox drequinox 14 Sep 21 05:54 message.txt -rw-rw-r– 1 drequinox drequinox 32 Sep 21 05:57 message.bin -rw-rw-r– 1 drequinox drequinox 45 Sep 21 06:00 message.b64 -rw-rw-r– 1 drequinox drequinox 14 Sep 21 06:06 message.dec $ cat message.dec Datatoencrypt Astute have noticed that no IV has been provided, even though it’s required in all block encryption modes of operation except ECB.

The reason for this is that OpenSSL automatically derives the IV from the given password.

Conclusion

How AES works represents one of the many innovative layers that make blockchain technology so powerful and transformative. As distributed systems continue to evolve, a solid understanding of these core concepts becomes increasingly valuable — not just for developers, but for anyone building, investing in, or working alongside blockchain-powered systems.

Whether you are just starting your blockchain journey or deepening existing expertise, mastering these fundamentals gives you the tools to think clearly about decentralized systems and make smarter decisions in this rapidly evolving space.