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