Skip to main content

Padding has two primary uses in cryptography, ensuring messages are the proper length necessary for certain ciphers (e.g., block ciphers) or to provide assurances not built into the core cipher (e.g., semantic security)

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.