This is the seventh challenge of Set 1 in The Cryptopals Crypto Challenges website. Previously, I spoke about these challenges and provided walkthroughs for the previous challenges, if you haven't read them, here are the links:

- The Cryptopals Crypto Challenges
- The Cryptopals Crypto Challenges: Set 1 - Convert Hex to Base64
- Base64 Encoding / Decoding using Bitwise Manipulation in C++
- The Cryptopals Crypto Challenges: Set 1 - Fixed XOR Cipher
- The Cryptopals Crypto Challenges: Set 1 - Single-Byte XOR Cipher
- The Cryptopals Crypto Challenges: Set 1 - Detect Single-Character XOR
- The Cryptopals Crypto Challenges: Set 1 - Implement Repeating-Key XOR
- Hamming Distance Algorithm in C++
- The Cryptopals Crypto Challenges: Set 1 - Break Repeating-Key XOR

For this challenge, you are given a
file, which
contains a ciphertext that has been encrypted using ** AES-128 Cipher**
with

**mode and then encoded using Base64. Decrypt it.**

*ECB (Electronic Codebook)*In order to decrypt it, you are given a key:

` ````
YELLOW SUBMARINE
```

## What is AES?

Advanced Encryption
Standard
a.k.a ** Rjindael**, which was developed by two belgian cryptographers,
Vincent Rijmen and Joan
Daemen.

**is a family of ciphers with various block and key sizes.**

*Rjindael*** AES-128** is commonly used but there are also larger key sizes such as

**and**

*192***bits. Similar to**

*256***, it uses the same key to encrypt and decrypt the message. Till date, there isn't any publication that states if whether**

*XOR cipher***is broken but even if you were to break it, it will take atleast a**

*AES***with a supercomputer, which could beyond the age of the universe.**

*billion years*## What is ECB Mode?

What if your plaintext is longer than (in this case, 128 bits) the
keysize? This is where ** ECB** comes into the picture. ECB (Electronic
Codebook)
is a cipher mode that is used to repeat the key until it covers the
entire plaintext (similar to Repeating-Key XOR
Cipher)
and then each

**is independently encrypted using the**

*block***algorithm to produce the desired ciphertext.**

*AES*This challenge is not that hard, in fact, it's completely trivial and
more like an introduction of ** AES Cipher**. There are so many ways to
solve this problem but I chose to solve this problem using

**and other commandline tools such as**

*OpenSSL***(used to print the hexdump of a file) on my UNIX terminal.**

*xxd*Here's the solution:

` ````
openssl enc -aes-128-ecb -d -a -in secret.txt -K $(echo "YELLOW SUBMARINE" | xxd -p) -iv 1 | head
```

This is the decrypted message:

` ````
I'm back and I'm ringin' the bell
A rockin' on the mike while the fly girls yell
In ecstasy in the back of me
Well that's my DJ Deshay cuttin' all them Z's
Hittin' hard and the girlies goin' crazy
Vanilla's on the mike, man I'm not lazy.
I'm lettin' my drug kick in
It controls my mouth and I begin
To just let it flow, let my concepts go
```

Initially, I was planning to write an implementation of ** AES** for fun,
but then I decided to make it a side project that I can work on as there
are a lot of things about

**that I'd like to talk about in the future.**

*AES*Stay tuned for the next challenge!