DES_MODES(7ossl)
๐ des_modes โ the vibe check on DES modes ๐
Okay bestie, so this is des_modes, and it lives in the OpenSSL world (that's 7ossl for the manual peeps tracking it). Think of this as your group chat rundown of all the different flavors that crypto algorithms in OpenSSL can come in. Periodt. ๐
โจ DESCRIPTION โจ
So like, several of the crypto algorithms in OpenSSL can be used in a bunch of different modes. These modes are what let you use block ciphers kinda like stream ciphers, among other things. It's giving "versatility," it's giving "range." ๐ฆ
๐ธ OVERVIEW ๐ธ
๐ Electronic Codebook Mode (ECB)
Normally this shows up as the function algorithm_ecb_encrypt().
- 64 bits are enciphered at a time.
- The order of the blocks can literally be rearranged without anyone noticing. No detection whatsoever. ๐ญ
- The same plaintext block always produces the same ciphertext block (for the same key), which makes it vulnerable to a 'dictionary attack'. Not iconic of it, honestly. ๐
- An error will only affect one ciphertext block.
๐ Cipher Block Chaining Mode (CBC)
Normally this shows up as the function algorithm_cbc_encrypt().
Bestie be aware:des_cbc_encrypt()is not really DES CBC โ it does not update the IV. Usedes_ncbc_encrypt()instead. iykyk ๐
- A multiple of 64 bits are enciphered at a time.
- CBC mode produces the same ciphertext whenever the same plaintext is encrypted using the same key and starting variable.
- The chaining operation makes the ciphertext blocks dependent on the current and all preceding plaintext blocks, and therefore blocks cannot be rearranged. Slay, security. ๐
- Using different starting variables prevents the same plaintext from enciphering to the same ciphertext.
- An error will affect the current and the following ciphertext blocks.
๐ Cipher Feedback Mode (CFB)
Normally this shows up as the function algorithm_cfb_encrypt().
- A number of bits (j) <= 64 are enciphered at a time.
- CFB mode produces the same ciphertext whenever the same plaintext is encrypted using the same key and starting variable.
- The chaining operation makes the ciphertext variables dependent on the current and all preceding variables, so the j-bit variables are chained together and cannot be rearranged.
- Using different starting variables prevents the same plaintext from enciphering to the same ciphertext.
- The strength of CFB mode depends on the size of k (maximal if j == k). In my implementation this is always the case. ๐โโ๏ธ
- Picking a small value for j means more cycles through the encipherment algorithm per unit of plaintext, which means greater processing overheads. Lowkey expensive. ๐ฎโ๐จ
- Only multiples of j bits can be enciphered.
- An error will affect the current and the following ciphertext variables.
๐ Output Feedback Mode (OFB)
Normally this shows up as the function algorithm_ofb_encrypt().
- A number of bits (j) <= 64 are enciphered at a time.
- OFB mode produces the same ciphertext whenever the same plaintext is enciphered using the same key and starting variable. Moreover, in OFB mode the same key stream is produced when the same key and start variable are used. Consequently โ and this is the important part, bestie โ for security reasons a specific start variable should be used only once for a given key. No cap. ๐ฅ
- The absence of chaining makes OFB more vulnerable to specific attacks. ๐
- Using different start variable values prevents the same plaintext from enciphering to the same ciphertext, by producing different key streams.
- Picking a small value for j means more cycles through the encipherment algorithm per unit of plaintext, thus causing greater processing overheads.
- Only multiples of j bits can be enciphered.
- OFB mode does not extend ciphertext errors in the resultant plaintext output. Every bit error in the ciphertext causes only one bit to be in error in the deciphered plaintext. That's actually such a vibe. โญ
- OFB mode is not self-synchronizing. If the two operations of encipherment and decipherment get out of sync, the system needs to be re-initialized.
- Each re-initialization should use a value of the start variable different from the start variable values used before with the same key. The reason? An identical bit stream would be produced each time from the same parameters, which would be susceptible to a 'known plaintext' attack. So like, don't do that. ๐
๐ Triple ECB Mode
Normally this shows up as the function algorithm_ecb3_encrypt().
- Encrypt with key1, decrypt with key2, and encrypt with key3 again.
- Just like ECB encryption, but it increases the key length to 168 bits. There are theoretic attacks that can reduce the effective key length to 112 bits, but this attack also requires 2^56 blocks of memory โ not very likely, even for the NSA. ๐ญ๐
- If both keys are the same, it's equivalent to encrypting once with just one key.
- If the first and last key are the same, the key length is 112 bits. There are attacks that could reduce the effective key strength to only slightly more than 56 bits, but these require a lot of memory.
- If all 3 keys are the same, this is effectively the same as normal ECB mode.
๐ Triple CBC Mode
Normally this shows up as the function algorithm_ede3_cbc_encrypt().
- Encrypt with key1, decrypt with key2, and then encrypt with key3.
- Just like CBC encryption, but it increases the key length to 168 bits with the same restrictions as for triple ECB mode.
๐ NOTES ๐
Okay so fun fact โ this whole text was written in large parts by Eric Young in his original documentation for SSLeay, the predecessor of OpenSSL. And in turn, he attributed it to:
AS 2805.5.2
Australian Standard
Electronic funds transfer - Requirements for interfaces,
Part 5.2: Modes of operation for an n-bit block cipher algorithm
Appendix A
๐ SEE ALSO ๐
ยฉ๏ธ COPYRIGHT ยฉ๏ธ
Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
And that's the tea, bestie โ this was DES_MODES(7ossl), from OpenSSL version 3.5.6, dated 2026-04-07. Go forth and encrypt responsibly ๐ซถโจ๐
๐ฆ where this page comes from
- freebsd 15.1: base 15.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms