Padding
Block ciphers will encrypt a specific size of the block at a time. What if the data size is less than the block size? So, let's assume we are using a 128 bit (16 bytes) AES cipher, but we have only 10 bytes of data.
One way to approach this is to add additional data at the end so that the block size becomes full and the encryption can take place.
This additional content added is referred to as padding.
Let's take an example of such a use case. In the following figure, we can see that the block contains 14 partitions; however, the word happy me requires only 8 partitions.
In this case, additional data (A) is added at the end to fill the block, and the last partition contains a Padding Length so that we can later identify the original ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access