DES_MODES(7SSL)
π des_modes β the DES modes manual, but make it make sense π
okay bestie so this is DES_MODES(7SSL) from the OpenSSL manual set, and it's literally the lore drop on all the different modes you can run these crypto algorithms in. strap in. πΈ
β¨ NAME β¨
des_modes β the variants of DES and other crypto algorithms of OpenSSL π¦
π DESCRIPTION π
soooo a bunch of the crypto algorithms in OpenSSL can be used in multiple modes, right? and those modes are what let you use a block cipher in a way that feels kinda like a stream cipher, among other things. that's the whole vibe. π
π OVERVIEW π
π Electronic Codebook Mode (ECB) π
normally you'll find this as the function algorithm_ecb_encrypt().
- 64 bits get enciphered at a time. β
- the order of the blocks can be rearranged and nobody would detect it. π©
- the same plaintext block always produces the same ciphertext block (for the same key) β which makes it vulnerable to a 'dictionary attack'. bestie that's not a vibe.
- an error will only affect one ciphertext block. (silver lining lol)
π¦ Cipher Block Chaining Mode (CBC) π¦
normally you'll find this as the function algorithm_cbc_encrypt(). BUT β be aware that des_cbc_encrypt() is not really DES CBC (it does not update the IV). use des_ncbc_encrypt() instead. no cap, that one trips people up. π
- 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 can not be rearranged. slay, honestly.
- 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 you'll find this 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, and therefore j-bit variables are chained together and can not be rearranged.
- the use of different starting variables prevents the same plaintext 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 will require more cycles through the encipherment algorithm per unit of plaintext, and thus cause greater processing overheads. π
- only multiples of j bits can be enciphered.
- an error will affect the current and the following ciphertext variables.
π§ Output Feedback Mode (OFB) π§
normally you'll find this 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. more over, in OFB mode the same key stream is produced when the same key and start variable are used. consequently, for security reasons, a specific start variable should be used only once for a given key. β οΈ
- the absence of chaining makes OFB more vulnerable to specific attacks. π
- the use of different start variable values prevents the same plaintext enciphering to the same ciphertext, by producing different key streams.
- picking a small value for j will require more cycles through the encipherment algorithm per unit of plaintext and thus cause greater processing overheads.
- only multiples of j bits can be enciphered.
- OFB mode of operation 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. (iconic behaviour honestly)
- OFB mode is not self-synchronizing. if the two operations of encipherment and decipherment get out of synchronism, 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 for this is that an identical bit stream would be produced each time from the same parameters. that would be susceptible to a 'known plaintext' attack. π
π Triple ECB Mode π
normally you'll find this as the function algorithm_ecb3_encrypt().
- encrypt with
key1, decrypt withkey2, and encrypt withkey3again. - as for ECB encryption, but it increases the key length to 168 bits. there are theoretic attacks that can be used that make the effective key length 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 is 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 you'll find this as the function algorithm_ede3_cbc_encrypt().
- encrypt with
key1, decrypt withkey2, and then encrypt withkey3. - as for CBC encryption, but it increases the key length to 168 bits with the same restrictions as for triple ECB mode.
π NOTES π
this text was written in large parts by Eric Young in his original documentation for SSLeay (the predecessor of OpenSSL). 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>.
okay that's the whole page bestie, you ate that π
β¨ this was DES_MODES(7SSL) from OpenSSL 4.0.3, dated 2026-09-29 β go forth and pick your mode wisely, mwah ππ
π¦ where this page comes from
- ubuntu stonking: openssl 4.0.3-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms