Padding has two primary uses in cryptography, one for symmetric-key cryptography and one for public-key cryptography. In block ciphers, a kind of symmetric-key algorithm, messages must be the length of the block length (or a multiple of the block length if using a cryptographic mode of operation). Thus, padding is added to a message to ensure this property. In public-key cryptography, padding is used to enhance an algorithm's resistance to certain attacks. For example, padding used in RSA makes RSA semantically secure.

history | show excerpt | excerpt history