]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/xcrypt.3
share/mk/: distcheck: Run 'check' after 'build'
[thirdparty/man-pages.git] / man3 / xcrypt.3
1 .\" Copyright 2003 walter harms (walter.harms@informatik.uni-oldenburg.de)
2 .\"
3 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4 .\" Distributed under GPL
5 .\" %%%LICENSE_END
6 .\"
7 .\" this is the 3rd type of interface for cryptographic routines
8 .\" 1. encrypt() expects a bit field
9 .\" 2. cbc_crypt() byte values
10 .\" 3. xencrypt() a hexstring
11 .\" to bad to be true :(
12 .\"
13 .TH XCRYPT 3 2019-03-06 "" "Linux Programmer's Manual"
14 .SH NAME
15 xencrypt, xdecrypt, passwd2des \- RFS password encryption
16 .SH SYNOPSIS
17 .B "#include <rpc/des_crypt.h>"
18 .PP
19 .BI "void passwd2des(char " *passwd ", char *" key ");"
20 .PP
21 .BI "int xencrypt(char *" secret ", char *" passwd ");"
22 .PP
23 .BI "int xdecrypt(char *" secret ", char *" passwd ");"
24 .SH DESCRIPTION
25 .BR WARNING :
26 Do not use these functions in new code. They do not achieve
27 any type of acceptable cryptographic security guarantees.
28 .LP
29 The function
30 .BR passwd2des ()
31 takes a character string
32 .I passwd
33 of arbitrary length and fills a character array
34 .I key
35 of length 8.
36 The array
37 .I key
38 is suitable for use as DES key.
39 It has odd parity set in bit 0 of each byte.
40 Both other functions described here use this function to turn their
41 argument
42 .I passwd
43 into a DES key.
44 .PP
45 The
46 .BR xencrypt ()
47 function takes the ASCII character string
48 .I secret
49 given in hex,
50 .\" (over the alphabet 0123456789abcdefABCDEF),
51 which must have a length that is a multiple of 16,
52 encrypts it using the DES key derived from
53 .I passwd
54 by
55 .BR passwd2des (),
56 and outputs the result again in
57 .I secret
58 as a hex string
59 .\" (over the alphabet 0123456789abcdef)
60 of the same length.
61 .PP
62 The
63 .BR xdecrypt ()
64 function performs the converse operation.
65 .SH RETURN VALUE
66 The functions
67 .BR xencrypt ()
68 and
69 .BR xdecrypt ()
70 return 1 on success and 0 on error.
71 .SH VERSIONS
72 These functions are available in glibc since version 2.1.
73 .SH ATTRIBUTES
74 For an explanation of the terms used in this section, see
75 .BR attributes (7).
76 .TS
77 allbox;
78 lbw37 lb lb
79 l l l.
80 Interface Attribute Value
81 T{
82 .BR passwd2des (),
83 .BR xencrypt (),
84 .BR xdecrypt ()
85 T} Thread safety MT-Safe
86 .TE
87 .sp 1
88 .SH BUGS
89 The prototypes are missing from the abovementioned include file.
90 .SH SEE ALSO
91 .BR cbc_crypt (3)