Debian Codegraph @

upstream/debian-unstable/man3/xcrypt.3

raw
1 '\" t
2 .\" Copyright 2003, Walter Harms <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\"
7 .TH XCRYPT 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 xencrypt, xdecrypt, passwd2des \- RFS password encryption
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B "#include <rpc/des_crypt.h>"
16 .P
17 .BI "void passwd2des(char " *passwd ", char *" key ");"
18 .P
19 .BI "int xencrypt(char *" secret ", char *" passwd ");"
20 .BI "int xdecrypt(char *" secret ", char *" passwd ");"
21 .fi
22 .SH DESCRIPTION
23 .BR WARNING :
24 Do not use these functions in new code.
25 They do not achieve any type of acceptable cryptographic security guarantees.
26 .P
27 The function
28 .BR passwd2des ()
29 takes a character string
30 .I passwd
31 of arbitrary length and fills a character array
32 .I key
33 of length 8.
34 The array
35 .I key
36 is suitable for use as DES key.
37 It has odd parity set in bit 0 of each byte.
38 Both other functions described here use this function to turn their
39 argument
40 .I passwd
41 into a DES key.
42 .P
43 The
44 .BR xencrypt ()
45 function takes the ASCII character string
46 .I secret
47 given in hex,
48 .\" (over the alphabet 0123456789abcdefABCDEF),
49 which must have a length that is a multiple of 16,
50 encrypts it using the DES key derived from
51 .I passwd
52 by
53 .BR passwd2des (),
54 and outputs the result again in
55 .I secret
56 as a hex string
57 .\" (over the alphabet 0123456789abcdef)
58 of the same length.
59 .P
60 The
61 .BR xdecrypt ()
62 function performs the converse operation.
63 .SH RETURN VALUE
64 The functions
65 .BR xencrypt ()
66 and
67 .BR xdecrypt ()
68 return 1 on success and 0 on error.
69 .SH ATTRIBUTES
70 For an explanation of the terms used in this section, see
71 .BR attributes (7).
72 .TS
73 allbox;
74 lbx lb lb
75 l l l.
76 Interface Attribute Value
77 T{
78 .na
79 .nh
80 .BR passwd2des (),
81 .BR xencrypt (),
82 .BR xdecrypt ()
83 T} Thread safety MT-Safe
84 .TE
85 .SH VERSIONS
86 These functions are available since glibc 2.1.
87 .SH BUGS
88 The prototypes are missing from the abovementioned include file.
89 .SH SEE ALSO
90 .BR cbc_crypt (3)