Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Ciphertext stealing
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====CBC encryption steps==== # ''X''<sub>''n''β1</sub> = ''P''<sub>''n''β1</sub> XOR ''C''<sub>''n''β2</sub>. Exclusive-OR ''P''<sub>''n''β1</sub> with the previous ciphertext block, ''C''<sub>''n''β2</sub>, to create ''X''<sub>''n''β1</sub>. This is equivalent to the behavior of standard CBC mode. # ''E''<sub>''n''β1</sub> = Encrypt (''K'', ''X''<sub>''n''β1</sub>). Encrypt ''X''<sub>''n''β1</sub> to create ''E''<sub>''n''β1</sub>. This is equivalent to the behavior of standard CBC mode. # ''C''<sub>''n''</sub> = Head (''E''<sub>''n''β1</sub>, ''M''). Select the first ''M'' bits of ''E''<sub>''n''β1</sub> to create ''C''<sub>''n''</sub>. The final ciphertext block, ''C''<sub>''n''</sub>, is composed of the leading ''M'' bits of the second-to-last ciphertext block. In all cases, the last two blocks are sent in a different order than the corresponding plaintext blocks. # ''P'' = ''P''<sub>''n''</sub> || 0<sup>''B''β''M''</sup>. Pad ''P''<sub>''n''</sub> with zeros at the end to create ''P'' of length ''B''. The zero padding in this step is important for step 5. # ''D''<sub>''n''</sub> = ''E''<sub>''n''β1</sub> XOR ''P''. Exclusive-OR ''E''<sub>''n''β1</sub> with ''P'' to create ''D''<sub>''n''</sub>. For the first ''M'' bits of the block, this is equivalent to CBC mode; the first ''M'' bits of the previous block's ciphertext, ''E''<sub>''n''β1</sub>, are XORed with the ''M'' bits of plaintext of the last plaintext block. The zero padding of ''P'' in step 4 was important, because it makes the XOR operation's effect on the last ''B''β''M'' bits equivalent to copying the last ''B''β''M'' bits of ''E''<sub>''n''β1</sub> to the end of ''D''<sub>''n''</sub>. These are the same bits that were stripped off of ''E''<sub>''n''β1</sub> in step 3 when ''C''<sub>''n''</sub> was created. # ''C''<sub>''n''β1</sub> = Encrypt (''K'', ''D''<sub>''n''</sub>). Encrypt ''D''<sub>''n''</sub> to create ''C''<sub>''n''β1</sub>. For the first ''M'' bits, this is equivalent to what would happen in CBC mode (other than the ciphertext ordering). For the last ''B''β''M'' bits, this is the second time that these data have been encrypted under this key (It was already encrypted in the production of ''E''<sub>''n''β1</sub> in step 2).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)