1 .\" Copyright 2000 Nicolás Lichtmaier <nick@debian.org>
2 .\" Created 2000-07-22 00:52-0300
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
19 .\" Modified 2002-07-23 19:21:35 CEST 2002 Walter Harms
20 .\" <walter.harms@informatik.uni-oldenburg.de>
22 .\" Modified 2003-04-04, aeb
24 .TH ENCRYPT 3 2003-04-04 "" "Linux Programmer's Manual"
26 encrypt, setkey, encrypt_r, setkey_r \- encrypt 64-bit messages
28 .B #define _XOPEN_SOURCE
30 .B #include <unistd.h>
32 .BI "void encrypt(char " block "[64], int " edflag );
34 .B #define _XOPEN_SOURCE
36 .B #include <stdlib.h>
38 .BI "void setkey(const char *" key );
40 .B #define _GNU_SOURCE
42 .B "#include <crypt.h>"
44 .BI "void setkey_r(const char *" key ", struct crypt_data *" data );
46 .BI "void encrypt_r(char *" block ", int " edflag \
47 ", struct crypt_data *" data );
49 Each of these requires linking with \fI\-lcrypt\fP.
51 These functions encrypt and decrypt 64-bit messages.
54 function sets the key used by
58 parameter used here is an array of 64 bytes, each of which has
59 numerical value 1 or 0.
60 The bytes key[n] where n=8*i-1 are ignored,
61 so that the effective key length is 56 bits.
65 function modifies the passed buffer, encoding if
67 is 0, and decoding if 1 is being passed.
68 Like the key parameter also
70 is a bit vector representation of the actual value that is encoded.
71 The result is returned in that same vector.
73 These two functions are not reentrant, that is, the key data is
74 kept in static storage.
79 are the reentrant versions.
80 They use the following
81 structure to hold the key data:
86 char keysched[16 * 8];
93 long int current_saltbits;
106 These functions do not return any value.
110 to zero before calling the above functions.
111 On success, it is unchanged.
114 The function is not provided.
115 (For example because of former USA export restrictions.)
121 conform to SVr4, SUSv2, and POSIX.1-2001.
128 In glibc 2.2 these functions use the DES algorithm.
130 You need to link with libcrypt to compile this example with glibc 2.2.
131 To do useful work the
135 arrays must be filled with a useful bit pattern.
138 #define _XOPEN_SOURCE
145 char key[64]; /* bit pattern for key */
146 char txt[64]; /* bit pattern for messages */
149 encrypt(txt, 0); /* encode */
150 encrypt(txt, 1); /* decode */
158 .BR feature_test_macros (7)