Residual block termination
In cryptography, residual block termination is a variation of cipher block chaining mode (CBC) that does not require any padding. It does this by effectively changing to cipher feedback mode for one block. The cost is the increased complexity.
Encryption procedure
If the plaintext length N is not a multiple of the block size L:
- Encrypt the ⌊N/L⌋ full blocks of plaintext using the cipher block chaining mode;
- Encrypt the last full encrypted block again;
- XOR the remaining bits of the plaintext with leftmost bits of the re-encrypted block.
Decryption procedure
Short message
For messages shorter than one block, residual block termination can use an encrypted IV instead of the previously encrypted block.
gollark: It's not actually very complex and I'm not massively good. I've just done it for a while.
gollark: I've made my website (static-site-generated), a really slow search engine thing, dice roller, automatic music player thing which just runs from a directory of metadata-tagged music files, a Discord bot for something, Meme Economy Autotrader, a moderately popular browser extension for automating some specific task in an online game, various random "experiments" on my website, a virus for computers in a Minecraft computer mod (and many, many other things for that), and probably other random stuff.
gollark: I do programming myself, but I really only make random projects either for personal use, mild evil, or fun. They're basically all released as open source.
gollark: Also working but very slowly, buggily, inefficiently, badly or whatever else.
gollark: In general, I mean, there's such a thing as technical debt.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.