OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / release / man3 / crypt.3
1 .\" Michael Haardt (michael@cantor.informatik.rwth.aachen.de)
2 .\"     Sat Sep  3 22:00:30 MET DST 1994
3 .\"
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.
8 .\"
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.
13 .\"
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.
18 .\"
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, write to the Free
21 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
22 .\" USA.
23 .\"
24 .\" Sun Feb 19 21:32:25 1995, faith@cs.unc.edu edited details away
25 .\"
26 .\" TO DO: This manual page should go more into detail how DES is perturbed,
27 .\" which string will be encrypted, and what determines the repetition factor.
28 .\" Is a simple repetition using ECB used, or something more advanced?  I hope
29 .\" the presented explanations are at least better than nothing, but by no
30 .\" means enough.
31 .\"
32 .\" added _XOPEN_SOURCE, aeb, 970705
33 .\" added GNU MD5 stuff, aeb, 011223
34 .\"
35 .\" Japanese Version Copyright (c) 1998 Hiroaki Nagoya and MAEHARA Kouichi all rights reserved.
36 .\" Translated Sun Sep 27 JST 1998 by Hiroaki Nagoya <nagoya@cc.hit-u.ac.jp> and MAEHARA Kouichi <maeharak@kw.netlaputa.ne.jp>
37 .\" Updated 2002-01-19 by Kentaro Shirakata <argrath@ub32.org>
38 .\" Updated 2007-01-01 by Kentaro Shirakata <argrath@ub32.org>
39 .\" Updated 2008-07-30 by Kentaro Shirakata <argrath@ub32.org>
40 .\" Updated 2009-09-28 by Kentaro Shirakata <argrath@ub32.org>
41 .\"
42 .\"WORD: encryption °Å¹æ²½
43 .\"WORD: key ¸°
44 .\" "
45 .TH CRYPT 3 2010-06-20 "" "Linux Programmer's Manual"
46 .SH Ì¾Á°
47 crypt, crypt_r \- ¥Ñ¥¹¥ï¡¼¥É¤È¥Ç¡¼¥¿¤Î°Å¹æ²½
48 .SH ½ñ¼°
49 .nf
50 .B #define _XOPEN_SOURCE
51 .br
52 .B #include <unistd.h>
53 .sp
54 .BI "char *crypt(const char *" key ", const char *" salt );
55 .sp
56 .BI "char *crypt_r(const char *" key ", const char *" salt ,
57 .BI "              struct crypt_data *" data );
58 .fi
59 .sp
60 \fI\-lcrypt\fP ¤Ç¥ê¥ó¥¯¤¹¤ë¡£
61 .SH ÀâÌÀ
62 .BR crypt ()
63 ¤Ï¥Ñ¥¹¥ï¡¼¥É°Å¹æ²½´Ø¿ô¤Ç¤¢¤ë¡£
64 ¸°Ãµº÷¤Î¥Ï¡¼¥É¥¦¥§¥¢¤Ë¤è¤ë¼ÂÁõ¤ò˸¤²¤ë¤è¤¦¤Ë(¤½¤Î¾¤Ë¤â¤¤¤í¤¤¤í)
65 Êѹ¹¤·¤¿ Data Encryption Standard ¥¢¥ë¥´¥ê¥º¥à¤ò¸µ¤Ë¤·¤Æ¤¤¤ë¡£
66 .PP
67 .I key
68 ¤Ï¥æ¡¼¥¶¤¬ÆþÎϤ¹¤ë¥Ñ¥¹¥ï¡¼¥É¤Ç¤¢¤ë¡£
69 .PP
70 .I salt
71 ¤Ï½¸¹ç
72 [\fBa\fP\(en\fBzA\fP\(en\fBZ0\fP\(en\fB9./\fP]
73 ¤«¤éÁª¤Ð¤ì¤¿ 2 Ê¸»ú¤Îʸ»úÎó¤Ç¤¢¤ë¡£
74 ¤³¤Îʸ»úÎó¤Ï¥¢¥ë¥´¥ê¥º¥à¤Î½ÐÎϤò 4096 Ä̤ê¤Ë¤«¤­Í𤹤Τ˻Ȥï¤ì¤ë¡£
75 .PP
76 .I key
77 ¤ÎºÇ½é¤Î 8 Ê¸»ú¤Î³Æʸ»ú¤«¤é²¼°Ì 7 ¥Ó¥Ã¥È¤ò¤È¤Ã¤Æ 56 ¥Ó¥Ã¥È¤Î¸°¤¬ÆÀ¤é¤ì¤ë¡£
78 ¤³¤Î 56 ¥Ó¥Ã¥È¤Î¸°¤ÏÆÃÄê¤Îʸ»úÎó(¤Õ¤Ä¤¦¤Ï¤¹¤Ù¤Æ 0 ¤Îʸ»úÎó)
79 ¤ò·«¤êÊÖ¤·°Å¹æ²½¤¹¤ë¤Î¤ËÍѤ¤¤é¤ì¤ë¡£
80 ÊÖ¤êÃͤϰŹ沽¤µ¤ì¤¿¥Ñ¥¹¥ï¡¼¥É¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¡¢13 ¤Î°õ»ú²Äǽ¤Ê ASCII Ê¸»ú
81 ¤«¤é¤Ê¤ë(ºÇ½é¤Î 2 Ê¸»ú¤Ï salt ¤½¤Î¤â¤Î)¡£
82 ÊÖ¤êÃͤϡ¢´Ø¿ô¸Æ½Ð¤·¤Î¤¿¤Ó¤Ë¾å½ñ¤­¤µ¤ì¤ëÀÅŪ¤Ê¥Ç¡¼¥¿¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£
83 .PP
84 ·Ù¹ð: ¸°¶õ´Ö¤Ï
85 .if t 2\s-2\u56\s0\d
86 .if n 2**56
87 = 7.2e16 ¤Î²Äǽ¤ÊÃͤ«¤éÀ®¤ë¡£
88 ¤³¤Î¸°¶õ´Ö¤ÎÁ´Ãµº÷¤Ï¶¯ÎϤÊÊÂÎó·×»»µ¡¤ò»È¤¨¤Ð²Äǽ¤Ç¤¢¤ë¡£¤Þ¤¿
89 .BR crack (1)
90 ¤Î¤è¤¦¤Ê¥½¥Õ¥È¥¦¥§¥¢¤Ï¤³¤Î¸°¶õ´Ö¤ÎÃæ¤Ç¡¢Â¿¤¯¤Î¿Í¤Ë¥Ñ¥¹¥ï¡¼¥É¤È¤·¤Æ
91 »È¤ï¤ì¤ë¤è¤¦¤Ê¸°¤Ë¤Ä¤¤¤Æ¤ÎÁ´Ãµº÷¤¬²Äǽ¤Ç¤¢¤ë¡£
92 ¤½¤ì¤æ¤¨¡¢¥Ñ¥¹¥ï¡¼¥É¤òÁªÂò¤¹¤ë¤È¤­¤Ë¤Ï¡¢¤¹¤¯¤Ê¤¯¤È¤â¡¢
93 °ìÈÌŪ¤Ë»È¤ï¤ì¤ëñ¸ì¤È̾Á°¤ÏÈò¤±¤ë¤Ù¤­¤Ç¤¢¤ë¡£
94 .BR passwd (1)
95 ¤ò»È¤¦»þ¤Ë¤Ï¥¯¥é¥Ã¥¯¤µ¤ì¤¦¤ë¥Ñ¥¹¥ï¡¼¥É¤Ë¤Ä¤¤¤Æ¤Î¸¡ºº¤ò¤¹¤ë¤³¤È¤¬
96 ¿ä¾©¤µ¤ì¤ë¡£
97 .PP
98 DES ¥¢¥ë¥´¥ê¥º¥à¤Ë¤Ï¤¤¤¯¤Ä¤«¤ÎÊʤ¬¤¢¤ê¡¢¤½¤ì¤Ë¤è¤Ã¤Æ¥Ñ¥¹¥ï¡¼¥Éǧ¾Ú°Ê³°¤Ë
99 .BR crypt ()
100 ¤ò»È¤¦¤Î¤Ï¤¿¤¤¤Ø¤ó¤è¤¯¤Ê¤¤ÁªÂò¤È¤Ê¤Ã¤Æ¤¤¤ë¡£¤â¤·
101 .BR crypt ()
102 ¤ò°Å¹æ¥×¥í¥¸¥§¥¯¥È¤Ë»È¤ª¤¦¤È¤¤¤¦°Æ¤ò¤â¤Ã¤Æ¤¤¤ë¤Ê¤é¤Ð¡¢¤½¤ì¤Ï¤ä¤á¤¿¤Û¤¦¤¬
103 ¤è¤¤¡£°Å¹æ²½¤Ë¤Ä¤¤¤Æ¤Î¤è¤¤ËܤÈï¤Ç¤âÆþ¼ê¤Ç¤­¤ë DES ¥é¥¤¥Ö¥é¥ê¤Î¤Ò¤È¤Ä¤ò
104 ¼ê¤Ë¤¤¤ì¤ë¤Ù¤­¤À¡£
105
106 .BR crypt_r ()
107 ¤Ï
108 .BR crypt ()
109 ¤ÎºÆÆþ²ÄǽÈǤǤ¢¤ë¡£
110 .I data
111 ¤Ç¼¨¤µ¤ì¤ë¹½Â¤ÂΤϷë²Ì¥Ç¡¼¥¿¤ÎÊݸ¤È¾ðÊó¤Î´ÉÍý¤Ë»È¤ï¤ì¤ë¡£
112 ¤³¤Î¹½Â¤ÂΤËÂФ·¤Æ(¥á¥â¥ê¤ò³ä¤êÅö¤Æ¤ë¤³¤È°Ê³°¤Ë)¸Æ¤Ó½Ð¤·¸µ¤¬¤¹¤ë¤Ù¤­Í£°ì¤Î
113 ¤³¤È¤Ï¡¢
114 .BR crypt_r ()
115 ¤Î½é²ó¤Î¸Æ¤Ó½Ð¤·¤ÎÁ°¤Ë
116 .I data->initialized
117 ¤ò¥¼¥í¤Ë¤¹¤ë¤³¤È¤À¤±¤Ç¤¢¤ë¡£
118 .SH ÊÖ¤êÃÍ
119 À®¸ù¤Î¾ì¹ç¤Ë¤Ï¡¢°Å¹æ²½¤µ¤ì¤¿¥Ñ¥¹¥ï¡¼¥É¤Ø¤Î¥Ý¥¤¥ó¥¿¡¼¤¬ÊÖ¤µ¤ì¤ë¡£
120 ¥¨¥é¡¼¤Î¾ì¹ç¤Ë¤Ï NULL ¤¬ÊÖ¤µ¤ì¤ë¡£
121 .SH ¥¨¥é¡¼
122 .TP
123 .B ENOSYS
124 .BR crypt ()
125 ´Ø¿ô¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£Â¿Ê¬¥¢¥á¥ê¥«¤ÎÍ¢½Ðµ¬À©¤Î¤¿¤á¤Ë¡£
126 .\" ¤³¤Î¥ì¥Ù¥ë¤Î¾ÜºÙ¤Ï¤³¤Î¥Þ¥Ë¥å¥¢¥ë¤Ë¤ÏɬÍפʤ¤¤À¤í¤¦¡Ä
127 .\" (ÌõÃí: °Ê²¼¤Ï MAEHARA Kouichi <maeharak@kw.netlaputa.ne.jp> ¤µ¤ó¤ÎÌõ)
128 .\" .PP
129 .\"ʿʸ P ¤ò¸° K ¤Ç¤â¤Ã¤Æ DES ¤òÍѤ¤¤Æ°Å¹æ²½¤·¤¿¤È¤­¤Î·ë²Ì¤Î°Å¹æʸ
130 .\"¤ò C ¤È¤¹¤ë¤Ê¤é¤Ð¡¢P ¤ËÂФ¹¤ë 2 ¤ÎÊä¿ôŪ¤Êʿʸ P' ¤ò¸° K
131 .\"¤ËÂФ¹¤ëƱÍͤËÊä¿ôŪ¤Ê¸° K' ¤òÍѤ¤¤Æ°Å¹æ²½¤¹¤ë¤È C ¤ËÂФ·¤Æ¤ä¤Ï¤êÊä
132 .\"¿ôŪ¤Ê°Å¹æʸ C' ¤È¤Ê¤ë¡£
133 .\".PP
134 .\"DES ¤Ë¤è¤ë¸°¤ÎÊÑ·Á¤Ë¤ª¤¤¤Æ¡¢¾ï¤Ë¹¶·â¤ËÂФ·¤Æ¼å¤¤¸°¤¬Â¸ºß¤¹¤ë¡£¤è¤¯
135 .\"ÃΤé¤ì¤¿»Í¤Ä¤Î¼å¤¤¸°¤Ï 0101010101010101¡¢fefefefefefefefe¡¢
136 .\"1f1f1f1f0e0e0e0e¡¢e0e0e0e0f1f1f1f1 ¤Ç¤¢¤ê¤³¤ì¤é¤Î»ÈÍѤÏÈò¤±¤Ê¤±¤ì¤Ð
137 .\"¤Ê¤é¤Ê¤¤¡£
138 .\".PP
139 .\"Ʊ°ì¤Î°Å¹æ²½·ë²Ì¤òƳ¤¤¤Æ¤·¤Þ¤¦Ï»ÁȤΤä¤ä¼å¤¤¸°¤â¤¢¤ë¡£¤³¤¦¤·¤¿¤¤¤¯
140 .\"¤Ä¤«¤Î¸°¤Î»ÈÍѤϤä¤Ï¤êÈò¤±¤ë¤Ù¤­¤Ç¤¢¤ë¡£
141 .\"¿½¤·¤ï¤±¤Ê¤¤¤³¤È¤À¤¬¡¢¤³¤ì¤Ë¤É¤ó¤Ê¸°¤¬³ºÅö¤¹¤ë¤Î¤«¤ÏÄ´¤Ù¤­¤ì¤Ê¤«¤Ã
142 .\"¤¿¡£
143 .\".PP
144 .\"¶Ëü¤Ë¾éĹ²½¤Ç¤¢¤ë¥Ç¡¼¥¿¤Ï¡¢
145 .\".BR crypt ()
146 .\"¤Î¤è¤¦¤Ë
147 .\".I "°Å¹æɽ(codebook)"
148 .\"¥â¡¼¥É¤Ç¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë DES ¤Ë¤è¤ë°Å¹æ²½¤Ë¤ª¤¤¤Æ¤Ï¥È¥é¥Ö¥ë¤Î¤â¤È¤È¤Ê
149 .\"¤ë¡£
150 .\".BR crypt ()
151 .\"¤Ï¤½¤ÎÁÛÄêÄ̤ꡢ¥Ñ¥¹¥ï¡¼¥É¤Îǧ¾Ú¤ÎÌÜŪ¤Ë¤Î¤ßÍøÍѤ¹¤Ù¤­¤â¤Î¤Ç¤¢¤ê¡¢
152 .\"¥Ç¡¼¥¿¤Î°Å¹æ²½¥Ä¡¼¥ë¤È¤·¤ÆÍѤ¤¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
153 .\".PP
154 .\"Âè»Í S-box ¤Î¡¢ÀèƬ¤ÈËöÈø»°¤Ä¤Î½ÐÎÏ bit ·²¤Ï¡¢¤½¤ÎÆþÎÏ bit ·²¤Î´Ø¿ô
155 .\"¤È¤·¤Æɽ¤ï¤¹¤³¤È¤¬¤Ç¤­¤ë¡£¤³¤Î¤è¤¦¤Ê S-box ·²¤ÏƱ¤¸ÆþÎϤËÂФ·¤Æ¤ÏÉô
156 .\"ʬŪ¤ËƱ¤¸°Å¹æ²½·ë²Ì¤òÀ¸À®¤·¤Æ¤·¤Þ¤¦¤³¤È¤¬¼Â¸³¤Ë¤è¤Ã¤Æ¤¢¤­¤é¤«¤Ë¤µ
157 .\"¤ì¤Æ¤¤¤ë¡£¤³¤ì¤Ï¡¢¹ñ²È°ÂÁ´Êݾã¶É(NSA)¤¬ DES ¤Ë¤è¤ë°Å¹æ¥Ç¡¼¥¿¤Î²òÆɤò²Äǽ
158 .\"¤Ë¤¹¤ë¤¿¤á¤ËÀߤ±¤¿Î¢¸ý¤Ê¤Î¤Ç¤Ï¤Ê¤¤¤«¤Èµ¿¤ï¤ì¤Æ¤¤¤ë¡£
159 .\".PP
160 .\"¤³¤¦¤¤¤Ã¤¿Íýͳ¤Ë¤è¤ê¡¢crypt() ¤ò»ÈÍѤ·¤¿°Å¹æ²½¥Ç¡¼¥¿¤ò¸ø³«¤¹¤ë¤³¤È
161 .\"¤Ï°ÂÁ´¤Ç¤Ï¤Ê¤¤¤Èǧ¼±¤¹¤ë¤Ù¤­¤Ê¤Î¤Ç¤¢¤ë¡£
162 .SH ½àµò
163 .BR crypt ():
164 SVr4, 4.3BSD, POSIX.1-2001.
165 .BR crypt_r ()
166 ¤Ï GNU ³ÈÄ¥¤Ç¤¢¤ë¡£
167 .SH Ãí°Õ
168 .SS glibc ¤Ç¤ÎÃí°Õ
169 ¤³¤Î´Ø¿ô¤Î glibc2 ÈǤÏÄɲäΰŹ沽¥¢¥ë¥´¥ê¥º¥à¤ËÂбþ¤·¤Æ¤¤¤ë¡£
170
171 ¤â¤·
172 .I salt
173 ¤Îʸ»úÎ󤬠"$\fIid\fP$" ¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤Æ¡¢"$" ¤Ç½ª¤ï¤Ã¤Æ¤¤¤ëʸ»úÎó¤¬
174 ³¤¤¤Æ¤¤¤ë¾ì¹ç:
175 .RS
176
177 $\fIid\fP$\fIsalt\fP$\fIencrypted\fP
178
179 .RE
180 DES ¤ò»È¤¦Âå¤ï¤ê¤Ë¡¢
181 .I id
182 ¤Ç»ÈÍѤ¹¤ë°Å¹æ²½¼êË¡¤ò¼±Ê̤·¡¢¤³¤ì¤¬¥Ñ¥¹¥ï¡¼¥Éʸ»úÎó¤Î»Ä¤ê¤ÎÉôʬ¤ò²ò¼á¤¹¤ë
183 ÊýË¡¤ò·èÄꤹ¤ë¡£
184 .I id
185 ¤ÎÃͤȤ·¤Æ¡¢°Ê²¼¤ÎÃͤËÂбþ¤·¤Æ¤¤¤ë:
186 .RS
187 .TS
188 l l.
189 ID  | Method
190 _
191 1   | MD5
192 2a  | Blowfish (ËÜή¤Î glibc ¤Ë¤ÏÆþ¤Ã¤Æ¤¤¤Ê¤¤;
193     | ¤¤¤¯¤Ä¤«¤Î Linux ¥Ç¥£¥¹¥È¥ê¥Ó¥å¡¼¥·¥ç¥ó¤ÇÄɲ䵤ì¤Æ¤¤¤ë)
194 .\" openSUSE has Blowfish, but AFAICS, this option is not supported
195 .\" natively by glibc -- mtk, Jul 08
196 .\"
197 .\" md5 | Sun MD5
198 .\" glibc doesn't appear to natively support Sun MD5; I don't know
199 .\" if any distros add the support.
200 5   | SHA-256 (glibc 2.7 °Ê¹ß)
201 6   | SHA-512 (glibc 2.7 °Ê¹ß)
202 .TE
203 .RE
204
205 ½¾¤Ã¤Æ¡¢$5$\fIsalt\fP$\fIencrypted\fP ¤Ï SHA-256 ¤Ç¥¨¥ó¥³¡¼¥É¤µ¤ì¤¿
206 ¥Ñ¥¹¥ï¡¼¥É¤Ç¤¢¤ê¡¢$6$\fIsalt\fP$\fIencrypted\fP ¤Ï SHA-512 ¤Ç
207 ¥¨¥ó¥³¡¼¥É¤µ¤ì¤¿¥Ñ¥¹¥ï¡¼¥É¤Ç¤¢¤ë¡£
208
209 "\fIsalt\fP" ¤Ï salt ¤Ë¤ª¤±¤ë "$\fIid\fP$" ¤Ë°ú¤­Â³¤¯ 16 Ê¸»ú°Ê²¼¤Î
210 ʸ»úÎó¤Ç¤¢¤ë¡£
211 ¥Ñ¥¹¥ï¡¼¥Éʸ»úÎó¤Î°Å¹æ²½Éôʬ¤Ï¼ÂºÝ¤Ë·×»»¤µ¤ì¤¿¥Ñ¥¹¥ï¡¼¥É¤Ç¤¢¤ë¡£
212 ¤³¤Îʸ»úÎó¤Î¥µ¥¤¥º¤Ï¸ÇÄê¤Ç¤¢¤ë:
213 .TS
214 l l.
215 MD5     | 22 characters
216 SHA-256 | 43 characters
217 SHA-512 | 86 characters
218 .TE
219
220 "\fIsalt\fP" ¤È "\fIencrypted\fP" ¤Îʸ»ú¤Ï
221 [\fBa\fP\(en\fBzA\fP\(en\fBZ0\fP\(en\fB9./\fP] ¤Î½¸¹ç¤«¤é
222 Áª¤Ð¤ì¤ë¡£
223 MD5 ¤È SHA ¤Î¼ÂÁõ¤Ç¤Ï¡¢
224 .I key
225 Á´ÂΤ¬°ÕÌ£¤¬¤¢¤ë
226 (DES ¤Î¾ì¹ç¤Ë¤ÏºÇ½é¤Î 8 Ê¸»ú¤À¤±¤Ë°ÕÌ£¤¬¤¢¤ë)¡£
227 .SH ´ØÏ¢¹àÌÜ
228 .BR login (1),
229 .BR passwd (1),
230 .BR encrypt (3),
231 .BR getpass (3),
232 .BR passwd (5),
233 .BR feature_test_macros (7)