des_crypt(3)
π des_crypt β bestie, we gotta talk π
okay so this page is des_crypt(3), and it lives in the Library Functions Manual, which is giving "vintage section of the manual" energy. sit down, grab a lil drink, because this one is a whole β¨journeyβ¨ β it's fast DES encryption, it's deprecated like six ways from Sunday, and it got removed.
πΈ NAME πΈ
des_crypt, ecb_crypt, cbc_crypt, des_setparity, DES_FAILED β fast DES encryption. that's the whole vibe, no notes π
π LIBRARY π
Standard C library (libc, -lc). classic.
β¨ SYNOPSIS β¨
#include <rpc/des_crypt.h>
[[deprecated]] int ecb_crypt(unsigned int datalen;
char *key, char data[datalen],
unsigned int datalen, unsigned int mode);
[[deprecated]] int cbc_crypt(unsigned int datalen;
char *key, char data[datalen],
unsigned int datalen, unsigned int mode,
char *ivec);
[[deprecated]] void des_setparity(char *key);
[[deprecated]] int DES_FAILED(int status);
not me counting the [[deprecated]] tags... it's five, bestie, five of them π the compiler is literally telling you to move on and honestly? listen to it.
fr fr, that datalen shows up twice in each of the first two prototypes in the original page and we're keeping it exactly as it is, no edits, no cap. i don't make the rules, i just relay them π
π¦ DESCRIPTION π¦
ecb_crypt() and cbc_crypt() implement the NBS DES (Data Encryption Standard). they're faster and more general purpose than crypt(3), and they can also use DES hardware if it's available. main character energy, truly.
ecb_crypt()encrypts in ECB (Electronic Code Book) mode β it encrypts blocks of data independently, like they don't even know each other π§cbc_crypt()encrypts in CBC (Cipher Block Chaining) mode β it chains together successive blocks. CBC mode protects against insertions, deletions, and substitutions of blocks. also, regularities in the clear text will not appear in the cipher text. that part is lowkey iconic π«Ά
here's how you use these routines, step by step:
- the first argument,
key, is the 8-byte encryption key with parity. to set the key's parity β which for DES is in the low bit of each byte β usedes_setparity(). - the second argument,
data, holds the data to be encrypted or decrypted. - the third argument,
datalen, is the length in bytes ofdata, and it must be a multiple of 8. - the fourth argument,
mode, is formed by ORing together some things:- for the encryption direction, OR in either
DES_ENCRYPTorDES_DECRYPT. - for software versus hardware encryption, OR in either
DES_HWorDES_SW. - if
DES_HWis specified and there's no hardware, then the encryption is performed in software and the routine returnsDESERR_NOHWDEVICE.
- for the encryption direction, OR in either
- for
cbc_crypt(), the argumentivecis the 8-byte initialization vector for the chaining. it gets updated to the next initialization vector upon return. she moves on, we love that for her π
π₯ RETURN VALUE π₯
DESERR_NONEβ no error. slay, we're fine.DESERR_NOHWDEVICEβ encryption succeeded, but done in software instead of the requested hardware. she tried her best π₯ΊDESERR_HWERRORβ an error occurred in the hardware or driver. it's giving chaos πDESERR_BADPARAMβ bad argument to routine. who did this.
and here's the lil trick: given a result status stat, the macro DES_FAILED(stat) is false only for the first two statuses. so DESERR_NONE and DESERR_NOHWDEVICE = we're chillin, anything else = we are not π«
π ATTRIBUTES π
for an explanation of the terms used in this section, see attributes(7).
ecb_crypt(),cbc_crypt(),des_setparity()β Thread safety βMT-Safe. yes bestie, thread safe, go off π
β STANDARDS β
None. literally none. she's untethered, she's free, she answers to no standard π¦
π HISTORY π
4.3BSD. glibc 2.1. Removed in glibc 2.28. RIP boo, you had a good run π
β οΈ and here's the big one: because they employ the DES block cipher, which is no longer considered secure, these functions were removed. applications should switch to a modern cryptography library, such as libgcrypt. that's not a suggestion, that's a glow-up mandate. do NOT try to resurrect DES for anything real, i am begging π
π SEE ALSO π
and that's the page, bestie!! this was Linux man-pages 6.20, dated 2026-02-08 πΈ go forth, use a modern crypto library, and stay encrypted (the secure way) πβ¨ππ«Ά
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-1.0-or-later
- Copyright 1993, Eric Young
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms