r/AskComputerScience • u/Ifyouliveinadream • Aug 26 '25
How do you decode AES ECB?
I only know ASCII, for that you just convert it to decimal and then look at a chart to see the letter.
I can't find that for AES ECB.
Also how do you know when something is encrypted in AES ECB vs ASCII?
0
Upvotes
3
u/high_throughput Aug 26 '25
You take a group of 16 bytes and run them through the AES decryption algorithm (with the secret key as a parameter) to give you the decoded 16 bytes. Then you continue to the next group.
This would take weeks to do by hand and it would inevitably be wrong so don't try. A lookup table would be big enough to fill all the books in the world a billion times over so don't try that either.
You can tell whether it's encrypted by whether it looks like binary gibberish in a text editor.
5
u/meditonsin Aug 26 '25
AES is an encryption algorithm, ECB is a mode of operation for the algorithm (see e.g. the AES wikipedia article). Not being able to just decode it from a table is kinda the point.
ASCII is an encoding for text, not a form of encryption. Those are very different things.
1
u/JeLuF Aug 26 '25
ASCII is not encrypted. It's encoded. You have a simple mapping between the bytes and their meaning.
AES is an encryption method. You need a "key" (e.g. a password) to encrypt and decrypt the byte stream. It turns a byte stream with meaning (e.g. an ASCII encoded text, a JPEG encoded image, etc), into an apparently random stream of bytes. Without the key, you can't retrieve the meaning from this bytestream.
Some programs write an (ASCII) prefix in front of the AES byte stream, e.g. "--- BEGIN AES ---", other protocols don't tell you which encryption is being used and the other side needs to know which encryption to expect.
1
u/ghjm MSCS, CS Pro (20+) Aug 26 '25
You can use openssl:
openssl enc -d -aes-256-ecb -in <input file> -out <output file>