I would like to know what is difference in between using salt and using "random padding" in cryptography. I am familiar with term salt when we use it with hashing. How does "random padding" differ from "salting" ? It might be the case that these terms are used in different context, but they mean the same or do they ?

Wikipedia article on random padding and salting. I've read both wikipedia articles but i see it as they are the same but they are used in slightly different contexts. Maybe someone who is more familiar with these terms could explain on what is going on ?

  • Usually the confusion is between salt and IV, are you mixing up IV and padding? Nov 16, 2018 at 21:59

1 Answer 1


When we use a block cipher, that has a certain block size as DES has 64-bit and AES has 128-bit block size. With the modes of operations, we support larger size of plaintexts than the block sizes.

When the plaintext size is not divisible exactly by the blocksize of the cipher, some part must be filled for the last block (padding) and after the decryption must be removed (unpadding). There are various types of padding; as;

xxxxxxxxxxx1000000000 //bit padding
xxxxxxxxxxx0000000005 //ANSI X.923,
xxxxxxxxxxx0505050505 //PKCS#5 or PKCS#7 padding

The first one can be removed by searching the first 1 from the right. For the second one, there must be x (in number) 0x (in bytes) appended to the plaintext. Adding just random bits will not help, since we cannot resolve while unpadding.

Note: padding is also required in public key cryptography.

  • PKCS#7 (PKCS#5) padding is the most common with ANSI X.923 and bit padding early used. Note that PKCS padding at least one byte is always added thus is the message to be padded is an exact multiple of the block size an entire block of padding is added. See Padding (cryptography).
    – zaph
    Nov 18, 2018 at 8:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .