1 .\" Copyright 2000 Nicolas 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 .\" Japanese Version Copyright (c) 2000-2004 Yuichi SATO
25 .\" all rights reserved.
26 .\" Translated Sun Sep 24 06:18:14 JST 2000
27 .\" by Yuichi SATO <sato@complex.eng.hokudai.ac.jp>
28 .\" Updated & Modified Sun Sep 7 13:20:43 JST 2003
29 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
30 .\" Updated & Modified Sat Jan 17 01:27:31 JST 2004 by Yuichi SATO
35 .TH ENCRYPT 3 2003-04-04 "" "Linux Programmer's Manual"
38 .\"O encrypt, setkey, encrypt_r, setkey_r \- encrypt 64-bit messages
39 encrypt, setkey, encrypt_r, setkey_r \- 64 ビットのメッセージを暗号化する
42 .\"O .BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */"
43 .BR "#define _XOPEN_SOURCE" " /* feature_test_macros(7) 参照 */"
45 .B #include <unistd.h>
47 .BI "void encrypt(char " block "[64], int " edflag );
49 .\"O .BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */"
50 .BR "#define _XOPEN_SOURCE" " /* feature_test_macros(7) 参照 */"
52 .B #include <stdlib.h>
54 .BI "void setkey(const char *" key );
56 .\"O .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
57 .BR "#define _GNU_SOURCE" " /* feature_test_macros(7) 参照 */"
61 .BI "void setkey_r(const char *" key ", struct crypt_data *" data );
63 .BI "void encrypt_r(char *" block ", int " edflag \
64 ", struct crypt_data *" data );
66 .\"O Each of these requires linking with \fI\-lcrypt\fP.
67 これらの関数は \fI\-lcrypt\fP でリンクする必要がある。
70 .\"O These functions encrypt and decrypt 64-bit messages.
73 .\"O function sets the key used by
75 これらの関数は、64 ビットのメッセージの暗号化と復号化を行う。
82 .\"O argument used here is an array of 64 bytes, each of which has
83 .\"O numerical value 1 or 0.
84 .\"O The bytes key[n] where n=8*i-1 are ignored,
85 .\"O so that the effective key length is 56 bits.
88 は 64 バイトの配列であり、各バイトは数値 1 または 0 である。
89 n=8*i-1 に対するバイト key[n] は無視されるので、
94 .\"O function modifies the passed buffer, encoding if
96 .\"O is 0, and decoding if 1 is being passed.
101 .\"O is a bit vector representation of the actual value that is encoded.
102 .\"O The result is returned in that same vector.
106 が 0 の場合は暗号化し、1 が渡された場合は復号化するというように、
112 はエンコードされた実際の値を表現するビットの配列である。
115 .\"O These two functions are not reentrant, that is, the key data is
116 .\"O kept in static storage.
120 .\"O .BR encrypt_r ()
121 .\"O are the reentrant versions.
122 .\"O They use the following
123 .\"O structure to hold the key data:
124 これら 2 つの関数はリエントラント (reentrant) ではない。
125 つまり暗号鍵データは静的な領域に保存される。
131 これらの関数は暗号鍵データを保持するために以下のような構造体を使う。
136 char keysched[16 * 8];
141 char crypt_3_buf[14];
142 char current_salt[2];
143 long int current_saltbits;
153 .\"O .I data\->initialized
157 .I data\->initialized
159 .\"O .SH "RETURN VALUES"
161 .\"O These functions do not return any value.
167 .\"O to zero before calling the above functions.
171 .\"O On success, it is unchanged.
175 .\"O The function is not provided.
176 .\"O (For example because of former USA export restrictions.)
177 (例えば以前のアメリカ合衆国輸出規制などにより)
179 .\"O .SH "CONFORMING TO"
185 .\"O conform to SVr4, SUSv2, and POSIX.1-2001.
190 は SVr4, SUSv2, and POSIX.1-2001 に準拠する。
192 .\"O .BR encrypt_r ()
195 .\"O are GNU extensions.
203 .\"O In glibc 2.2 these functions use the DES algorithm.
204 glibc 2.2 では、これらの関数は DES アルゴリズムを使う。
207 .\"O You need to link with libcrypt to compile this example with glibc.
208 .\"O To do useful work the
212 .\"O arrays must be filled with a useful bit pattern.
213 この例を glibc でコンパイルするには libcrypt とリンクする必要がある。
218 に有効なビットパターンを指定しなければならない。
221 #define _XOPEN_SOURCE
228 char key[64]; /* bit pattern for key */
229 char txt[64]; /* bit pattern for messages */
232 encrypt(txt, 0); /* encode */
233 encrypt(txt, 1); /* decode */