2
$\begingroup$

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.

$\endgroup$
  • 2
    $\begingroup$ You are trying to do this by hand or with software? $\endgroup$ – mikeazo Oct 31 '18 at 15:26
  • $\begingroup$ divide the plaintext into 128 blocks, say $P=p_1,p_2,\ldots\,p_2$ encrypt each by $c_i = E_k(p_i)$, Note that, your plaintext may not be 0 mode 128 than you need a padding. fill 1 and rest 0 will be enough. note 2: ECM mode is not secure. $\endgroup$ – kelalaka Oct 31 '18 at 15:26
  • 1
    $\begingroup$ Where do you get stuck? $\endgroup$ – Thomas M. DuBuisson Oct 31 '18 at 15:30
  • $\begingroup$ Yeah I'm trying to do by hand to visually see how it works $\endgroup$ – Benza Jackpuut Oct 31 '18 at 15:32
  • 1
    $\begingroup$ OMG. you are trying to encrypt AES with the hand? Good luck for you not having an error. this video might help you. $\endgroup$ – kelalaka Oct 31 '18 at 15:52
5
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.