XCRYPT(3)

✨ XCRYPT β€” bestie's guide to RFS password encryption ✨

ok so real talk, we're in section 3 of the manual, the library functions zone, and today's main characters are xencrypt, xdecrypt and passwd2des 🫢 they do RFS password encryption and they live in the Standard C library (libc, link it with -lc) πŸ’–


🌸 SYNOPSIS 🌸

#include <rpc/des_crypt.h>

void passwd2des(char *passwd, char *key);

int xencrypt(char *secret, char *passwd);
int xdecrypt(char *secret, char *passwd);

πŸŽ€ DESCRIPTION πŸŽ€

WARNING: Do not use these functions in new code. They do not achieve any type of acceptable cryptographic security guarantees.

no fr fr, that's the literal first line of the description and it is not a drill πŸ’€ these functions are not giving security, they're giving ✨legacy✨ β€” so keep them out of anything new, bestie.

okay so the way this little trio works:

  • passwd2des() takes a character string passwd of arbitrary length and fills a character array key of length 8 πŸ”‘ that array key is suitable for use as a DES key, and it has odd parity set in bit 0 of each byte ✨ both of the other functions described here use this function to turn their argument passwd into a DES key.
  • xencrypt() takes the ASCII character string secret given in hex, which must have a length that is a multiple of 16, encrypts it using the DES key derived from passwd by passwd2des(), and outputs the result again in secret as a hex string of the same length πŸ’… yes it writes back into secret, she's an in-place girlie.
  • xdecrypt() performs the converse operation β€” it undoes exactly that 🌈

πŸ’« RETURN VALUE πŸ’«

The functions xencrypt() and xdecrypt() return 1 on success and 0 on error 🎯 (not a negative-number situation, just vibes and ones and zeroes).


πŸ¦‹ ATTRIBUTES πŸ¦‹

For an explanation of the terms used in this section, see attributes(7).

  • Interface: passwd2des(), xencrypt(), xdecrypt()
  • Attribute: Thread safety
  • Value: MT-Safe πŸ‘‘

so yes bestie, they're MT-Safe, no cap.


⭐ VERSIONS ⭐

These functions are available since glibc 2.1 πŸ•°οΈ old money, iconic, but old.


πŸ’€ BUGS πŸ’€

The prototypes are missing from the abovementioned include file 😭 so like, the header <rpc/des_crypt.h> that we literally just told you to include? yeah, the prototypes aren't in it. it's giving chaos. it's giving "figure it out yourself."


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, periodt πŸ’œ this was XCRYPT(3) from Linux man-pages 6.20, dated 2026-02-08 β€” go forth, don't use it in new code, and hydrate πŸ“πŸ§š

πŸ“¦ 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