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 β€” use des_setparity().
  • the second argument, data, holds the data to be encrypted or decrypted.
  • the third argument, datalen, is the length in bytes of data, 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_ENCRYPT or DES_DECRYPT.
    • for software versus hardware encryption, OR in either DES_HW or DES_SW.
    • if DES_HW is specified and there's no hardware, then the encryption is performed in software and the routine returns DESERR_NOHWDEVICE.
  • for cbc_crypt(), the argument ivec is 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms