5

I'm fairly new to cryptography and am starting to understand this weird art of Mathematics and theory. One thing I am trying to understand and do is encrypting a plaintext into ciphertext using AES in ECB mode. For example, I want to encrypt the following plaintext: "Lucozade".

Would be great if someone could help me out with this as I am not sure how to integrate AES in ECB mode.

Maarten Bodewes
  • 92,551
  • 13
  • 161
  • 313
Benza Jackpuut
  • 133
  • 2
  • 6

1 Answers1

9

Here are some things to keep in mind

  1. AES encrypts bytes, not characters. So you have to transform your plaintext into bytes. How are you going to do that?
  2. In AES, a block is 128 bits. That is 16 bytes. If your plaintext is only 8 characters long, and each character is encoded as 1 byte, you are short 8 bytes. You can add some padding (a 1 followed by all 0's, something like that).
  3. ECB mode is insecure (except maybe in some very specific use cases). That being said since you are only encrypting less than 1 block, and you are just doing it to try to learn AES, you shouldn't even really be concerned with a mode-of-encryption at this point. Just focus on AES running on a single block.

Without more information on where you are getting stuck, there isn't much more help I can give.

mikeazo
  • 38,563
  • 8
  • 112
  • 180