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 stringpasswdof arbitrary length and fills a character arraykeyof length8π that arraykeyis 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 argumentpasswdinto a DES key.xencrypt()takes the ASCII character stringsecretgiven in hex, which must have a length that is a multiple of 16, encrypts it using the DES key derived frompasswdbypasswd2des(), and outputs the result again insecretas a hex string of the same length π yes it writes back intosecret, 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
- Copyright 2003, Walter Harms <walter.harms@informatik.uni-oldenburg.de>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms