# How AES treat string input to encrypt data and what will happen if the cipher key is less than that expected?

The official docs of AES have several example of how hexadecimal or byte input can be encrypted. I have some problem about the input text and cipher key. My question is:

1. How can encrypt string input in AES or how AES treat string input? If I use a string input [example: "Admin"] than how AES encrypt it? If I use the following hexadecimal input: 32 43 f6 a8 88 5a 30 8d 31 31 98 a2 e0 [which has 24 bits less than the expected input for AES-128], than how can it encrypt?

2. How the cipher key is scheduled if it is less than 128 bit (for AES 128), or less than 192 bit (for AES 192) or less than 256 (for AES 256)? If I use the cipher key: 2b 7e 15 16 28 ae d2 a6 ab f7 15 88 09 [Which has 3 less hexadecimal input than the expected for AES-128], than how can it schedule for Add Round Key?

• If your key has less bytes than expected then it's not really a key, just something that you're trying to pretend is a key. – Thomas Jul 31 '15 at 10:50
• The answer to question 1 is here : google.com/url?sa=t&source=web&rct=j&url=http://… – dylan7 Jul 31 '15 at 13:41
• The word you are looking for is "Padding" – Richie Frame Jul 31 '15 at 20:18

## 1 Answer

How the cipher key is scheduled if it is less than 128 bit (for AES 128), or less than 192 bit (for AES 192) or less than 256 (for AES 256)?

That is undefined; the AES specification does not address that possibility. The AES 128 algorithm assumes that you give it 128 bits of key (and tells you exactly what to do with that key); it says nothing about what you should do if you're initially starting with less keying data.

The AES block cipher takes a 128, 192 or 256 bit key, and uses that to define a reversible mapping between 128 bit plaintext blocks and 128 bit ciphertext blocks. However, we often want to do other things than mapping 128 bit strings to 128 bit strings; so we use AES in some sort of "mode of operation" which can perform more versatile functions (such as CBC mode, which with padding, can handle arbitrary sized plaintexts). As modes such as CBC can handle odd sized plaintexts, and thus might be considered an answer to your first question. I suppose a mode of operation could also define how to handle an odd sized key (I haven't heard of such a thing, but it wouldn't be inconceivable).