OSDN Git Service

c8549a8d08c2d94bac3720d8843ad97f8987719d
[linuxjm/LDP_man-pages.git] / original / 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 2003-04-04 "" "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 .sp
19 .BI "void passwd2des(char " *passwd ", char *" key ");"
20 .sp
21 .BI "int xencrypt(char *" secret ", char *" passwd ");"
22 .sp
23 .BI "int xdecrypt(char *" secret ", char *" passwd ");"
24 .SH DESCRIPTION
25 The function
26 .BR passwd2des ()
27 takes a character string
28 .I passwd
29 of arbitrary length and fills a character array
30 .I key
31 of length 8.
32 The array
33 .I key
34 is suitable for use as DES key.
35 It has odd parity set in bit 0 of each byte.
36 Both other functions described here use this function to turn their
37 argument
38 .I passwd
39 into a DES key.
40 .LP
41 The
42 .BR xencrypt ()
43 function takes the ASCII character string
44 .I secret
45 given in hex,
46 .\" (over the alphabet 0123456789abcdefABCDEF),
47 which must have a length that is a multiple of 16,
48 encrypts it using the DES key derived from
49 .I passwd
50 by
51 .BR passwd2des (),
52 and outputs the result again in
53 .I secret
54 as a hex string
55 .\" (over the alphabet 0123456789abcdef)
56 of the same length.
57 .LP
58 The
59 .BR xdecrypt ()
60 function performs the converse operation.
61 .SH RETURN VALUE
62 The functions
63 .BR xencrypt ()
64 and
65 .BR xdecrypt ()
66 return 1 on success and 0 on error.
67 .SH VERSIONS
68 These routines are present in libc 4.6.27 and later, and in
69 glibc 2.1 and later.
70 .SH BUGS
71 The prototypes are missing from the abovementioned include file.
72 .SH SEE ALSO
73 .BR cbc_crypt (3)
74 .SH COLOPHON
75 This page is part of release 3.67 of the Linux
76 .I man-pages
77 project.
78 A description of the project,
79 information about reporting bugs,
80 and the latest version of this page,
81 can be found at
82 \%http://www.kernel.org/doc/man\-pages/.