I checked a piece of library code intended for encryption/decryption with AES, CBC, 256 Bit Key length.

To check the results I consulted the following website: https://www.devglan.com/online-tools/aes-encryption-decryption

Since AES uses a block size of 16 Bytes, it is clear to me that input data longer than 16 Bytes will be padded to 32 Byte and also produce an output of length 32 Bytes.

What I don´t understand (and what is also the problem in my code under test) is that for an input length of 16 Bytes (exactly one block length), it seems that the output (encrypted text) is already padded to 32 Bytes.

I read that padding in this case is more of a convention and not a necessity of the algorithm. Is that correct? If so:

-> What is the benefit of use padding if the input is perfectly in the right size

-> How do I decrypt a 16 Byte encrypted text?

  • 2
    \$\begingroup\$ This question seem to be off-topic on EE SE. Try crypto.stackexchange.com \$\endgroup\$ – Eugene Sh. Sep 19 '19 at 19:16
  • \$\begingroup\$ Agreed. Electrical engineers, technicians, or hobbyists, may not be able to answer your question here since you're asking about an en/decryption algorithm. However, if you asked about the circuitry of the algorithm, we could help out. \$\endgroup\$ – user103380 Sep 19 '19 at 19:58
  • 1
    \$\begingroup\$ I'm voting to close this question as off-topic because it is a question that is about software that is not specific to embedded systems. \$\endgroup\$ – Elliot Alderson Sep 19 '19 at 22:40

Your Answer

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

Browse other questions tagged or ask your own question.