Residual block termination
Encyclopedia
In cryptography
Cryptography
Cryptography is the practice and study of techniques for secure communication in the presence of third parties...

, residual block termination is a variation of cipher block chaining mode (CBC) that does not require any padding
Padding (cryptography)
-Classical cryptography:Official messages often start and end in predictable ways: My dear ambassador, Weather report, Sincerely yours, etc. The primary use of padding with classical ciphers is to prevent the cryptanalyst from using that predictability to find cribs that aid in breaking the...

. It does this by effectively changing to cipher feedback mode for one block. The cost is the increased complexity.

Encryption procedure

If the plaintext
Plaintext
In cryptography, plaintext is information a sender wishes to transmit to a receiver. Cleartext is often used as a synonym. Before the computer era, plaintext most commonly meant message text in the language of the communicating parties....

 length N is not a multiple of the block size
Block size (cryptography)
In modern cryptography, symmetric key ciphers are generally divided into stream ciphers and block ciphers. Block ciphers operate on a fixed length string of bits. The length of this bit string is the block size...

 L:
  • Encrypt the ⌊N/L⌋ full blocks of plaintext using the cipher block chaining mode
    Block cipher modes of operation
    In cryptography, modes of operation is the procedure of enabling the repeated and secure use of a block cipher under a single key.A block cipher by itself allows encryption only of a single data block of the cipher's block length. When targeting a variable-length message, the data must first be...

    ;
  • Encrypt the last full encrypted block again;
  • XOR the remaining bits of the plaintext with leftmost bits of the re-encrypted block.

Decryption procedure

  • Decrypt the ⌊N/L⌋ full encrypted blocks using the Cipher Block Chaining mode;
  • Encrypt the last full encrypted block;
  • XOR the remaining bits of the ciphertext with leftmost bits of the re-encrypted block.


Proof that this decryption procedure really is the inverse of the encryption procedure is left as an exercise for the reader.

Short message

For messages shorter than one block
Block size (cryptography)
In modern cryptography, symmetric key ciphers are generally divided into stream ciphers and block ciphers. Block ciphers operate on a fixed length string of bits. The length of this bit string is the block size...

, residual block termination can use an encrypted IV
Initialization vector
In cryptography, an initialization vector is a fixed-size input to a cryptographic primitive that is typically required to be random or pseudorandom...

instead of the previously encrypted block.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK