Why does CBC-Pad require padding even when the original plaintext length is an integer multiple of the block size, instead of allowing zero bytes of padding?
CBC-Pad是一种分组密码模式,用于处理任意长度的明文。它通过填充确保明文长度为块长的整数倍,并在密文中增加最多一个块的长度。填充字节相同且表示填充字节数量。若原始明文长度为块长整数倍,则需额外填充以避免零填充情况。 2025-12-11 06:56:49 Author: www.reddit.com(查看原文) 阅读量:1 收藏

CBC-Pad is a block cipher mode of operation used in the RC5 block cipher, but it could be used in any block cipher. CBC-Pad handles plaintext of any length. The ciphertext is longer than the plaintext by at most the size of a single block. Padding is used to assure that the plaintext input is a multiple of the block length. It is assumed that the original plaintext is an integer number of bytes. This plaintext is padded at the end by from 1 to bb bytes, where bb equals the block size in bytes. The pad bytes are all the same and set to a byte that represents the number of bytes of padding. For example, if there are 8 bytes of padding, each byte has the bit pattern 00001000. Why not allow zero bytes of padding? That is, if the original plaintext is an integer multiple of the block size, why not refrain from padding?


文章来源: https://www.reddit.com/r/netsecstudents/comments/1pjr2a5/why_does_cbcpad_require_padding_even_when_the/
如有侵权请联系:admin#unsafe.sh