From the course: Symmetric Cryptography Essential Training

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Padding

Padding

- [Instructor] When we're dealing with cryptographic algorithms, we first assume that the data we're dealing with is going to be in whole bytes. In addition, block ciphers expect that they're going to operate on entire blocks. So for example, if you're working with a block cipher that's expecting a 64-bit or 8-byte block and it only gets one byte, we have to fill in the remaining seven bytes with something. There's a number of different ways that we can do this, and they're fairly simple. One is called bit padding, and we append a byte containing a one bit followed by seven zero bits, and then one or more zero bytes to fill in the rest of the block. Another is the ANSI X.923 standard, which appends at least one byte. Each of them is a zero byte with the exception of the last one, which is set to the total number of bytes that are padding. So if we padded out six bytes, first five bytes would be zeros and the sixth byte would store the number six. The PKCS7 standard resembles X.923 in…

Contents