signal.2: srcfix
[man-pages.git] / man3 / xcrypt.3
blob4b425ccb836c2a8f1cf7a35e7671e34d985f96ee
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 2021-03-22 "" "Linux Programmer's Manual"
14 .SH NAME
15 xencrypt, xdecrypt, passwd2des \- RFS password encryption
16 .SH SYNOPSIS
17 .nf
18 .B "#include <rpc/des_crypt.h>"
19 .PP
20 .BI "void passwd2des(char " *passwd ", char *" key ");"
21 .PP
22 .BI "int xencrypt(char *" secret ", char *" passwd ");"
23 .BI "int xdecrypt(char *" secret ", char *" passwd ");"
24 .fi
25 .SH DESCRIPTION
26 .BR WARNING :
27 Do not use these functions in new code.
28 They do not achieve any type of acceptable cryptographic security guarantees.
29 .PP
30 The function
31 .BR passwd2des ()
32 takes a character string
33 .I passwd
34 of arbitrary length and fills a character array
35 .I key
36 of length 8.
37 The array
38 .I key
39 is suitable for use as DES key.
40 It has odd parity set in bit 0 of each byte.
41 Both other functions described here use this function to turn their
42 argument
43 .I passwd
44 into a DES key.
45 .PP
46 The
47 .BR xencrypt ()
48 function takes the ASCII character string
49 .I secret
50 given in hex,
51 .\" (over the alphabet 0123456789abcdefABCDEF),
52 which must have a length that is a multiple of 16,
53 encrypts it using the DES key derived from
54 .I passwd
56 .BR passwd2des (),
57 and outputs the result again in
58 .I secret
59 as a hex string
60 .\" (over the alphabet 0123456789abcdef)
61 of the same length.
62 .PP
63 The
64 .BR xdecrypt ()
65 function performs the converse operation.
66 .SH RETURN VALUE
67 The functions
68 .BR xencrypt ()
69 and
70 .BR xdecrypt ()
71 return 1 on success and 0 on error.
72 .SH VERSIONS
73 These functions are available in glibc since version 2.1.
74 .SH ATTRIBUTES
75 For an explanation of the terms used in this section, see
76 .BR attributes (7).
77 .ad l
78 .nh
79 .TS
80 allbox;
81 lbx lb lb
82 l l l.
83 Interface       Attribute       Value
85 .BR passwd2des (),
86 .BR xencrypt (),
87 .BR xdecrypt ()
88 T}      Thread safety   MT-Safe
89 .TE
90 .hy
91 .ad
92 .sp 1
93 .SH BUGS
94 The prototypes are missing from the abovementioned include file.
95 .SH SEE ALSO
96 .BR cbc_crypt (3)