An Introduction to the Advanced Encryption Standard (AES)

Adrienne Domingus
The Startup
Published in
4 min readOct 16, 2020

--

Encryption is a huge part of modern software engineering. This is true both of data within our own systems, but also encryption of data we send or receive with network requests, to ensure the security of data in flight and the validity of data received from other services.

Most modern languages have libraries or built-in functionality that can be used to implement encryption for us, so knowing the ins-and-outs in depth isn’t necessarily a prerequisite of working in parts of your system that use encryption. That said, it’s always good to know the basics of what the code we write actually does, so the goal of this article is to introduce concepts so you understand what the library code you’re using is doing under the hood.

For example, I wrote code that looks something like this, so wanted to know what all the pieces meant and were doing.

from Crypto import Random
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
def encrypt(value, key):
value = value.encode('ascii')
iv = Random.new().read(AES.block_size)
cipher = AES.new(key, AES.MODE_CBC, iv)
ciphertext = cipher.encrypt(pad(bytes(value, encoding='utf8'), size))
return iv + ciphertext

Let’s dive in!

Block Ciphers

--

--