/
280.txt
223 lines (166 loc) · 9.83 KB
/
280.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
* ダイジェストアルゴリズム (HTTP)
** 仕様書
[REFS[
- [21] [CITE@en[RFC 3230 - Instance Digests in HTTP]] ([TIME[2014-08-31 18:57:37 +09:00]] 版) <http://tools.ietf.org/html/rfc3230#section-4.1.1>
- [28] [[RFC 5843]] [CITE@en[Additional Hash Algorithms for HTTP Instance Digests]]
([[IETF情報提供RFC]]) <http://tools.ietf.org/html/rfc5843>
- [25] [CITE[Hypertext Transfer Protocol (HTTP) Digest Algorithm Values]] ([TIME[2014-01-31 02:45:29 +09:00]] 版) <http://www.iana.org/assignments/http-dig-alg/http-dig-alg.xhtml>
-- [30] 旧 [CITE[HTTP Digest Algorithm Values]]
<http://www.iana.org/assignments/http-dig-alg>
]REFS]
** 識別
[22] [[ダイジェストアルゴリズム]]の名前は、[[字句]]です [SRC[>>21]]。
[[大文字・小文字不区別]]です [SRC[>>21]]。
[FIG(railroad)[
= [[字句]]
]FIG]
[23] [[アルゴリズム]]によっては、[[引数]]を加えて指定する必要があるかもしれません [SRC[>>21]]。
;; 構文は[[引数 (HTTP)]] [SRC[>>21]] 参照。
[27] [[ダイジェストアルゴリズム]]名によって識別される[[符号化]]は、
[[引用文字列]]として表されるものか、 [CODE(HTTP)[[[;]]]] や [CODE(HTTP)[[[,]]]]
を使わないものかのいずれかでなければ[['''なりません''']] [SRC[>>25]]。
** 文脈
[34] [[ダイジェストアルゴリズム]]の名前と[[符号化]]された値は、
[[実現値ダイジェスト]]で使われます。
[35] [[ダイジェストアルゴリズム]]の名前は [CODE(HTTP)@en[[[Want-Digest:]]]]
[[ヘッダー]]でも使われます。
** ダイジェストアルゴリズムの一覧
[24] 次の[[ダイジェストアルゴリズム]]名があります。
[FIG(short list)[
- [CODE(HTTP)@en[[[ADLER32]]]]
- [CODE(HTTP)@en[[[MD5]]]]
- [CODE(HTTP)@en[[[SHA]]]]
- [CODE(HTTP)@en[[[SHA-256]]]]
- [CODE(HTTP)@en[[[SHA-512]]]]
- [CODE(HTTP)@en[[[UNIXcksum]]]]
- [CODE(HTTP)@en[[[UNIXsum]]]]
]FIG]
[26] [[IANA登録簿]]が用意されています [SRC[>>25]]。
** 歴史
[FIG(quote)[
[FIGCAPTION[
[29] RFC 3230 (実現値要約) 4.1.1 Digest algorithms
]FIGCAPTION]
> Digest algorithm values are used to indicate a specific digest
computation. For some algorithms, one or more parameters may be supplied.
要約算法値は特定要約計算を示すために使用します。
算法によっては、一つ以上の引数を供給するかもしれません。
>
- digest-algorithm = token
> The BNF for "parameter" is as is used in RFC 2616 [4]. All digest-algorithm values are case-insensitive.
[CODE(ABNF)[[[parameter]]]] の [[BNF]] は [[RFC 2616]]
で使われているものの通りです。すべての [CODE(ABNF)[digest-algorithm]]
値は大文字・小文字を区別しません。
> The Internet Assigned Numbers Authority (IANA) acts as a registry for
digest-algorithm values. Initially, the registry contains the
following tokens:
インターネット割り当て番号事務局 ([[IANA]])
が [CODE(ABNF)[digest-algorithm]] 値の登録簿として働きます。
最初に、登録簿は次の字句を含みます。
>
: MD5 :
The MD5 algorithm, as specified in RFC 1321 [15].
The output of this algorithm is encoded using the
base64 encoding [1].
: SHA :
The SHA-1 algorithm [12]. The output of this
algorithm is encoded using the base64 encoding [1].
: UNIXsum :
The algorithm computed by the UNIX "sum" command,
as defined by the Single UNIX Specification,
Version 2 [13]. The output of this algorithm is an
ASCII decimal-digit string representing the 16-bit
checksum, which is the first word of the output of
the UNIX "sum" command.
: UNIXcksum :
The algorithm computed by the UNIX "cksum" command,
as defined by the Single UNIX Specification,
Version 2 [13]. The output of this algorithm is an
ASCII digit string representing the 32-bit CRC,
which is the first word of the output of the UNIX
"cksum" command.
: [CODE(HTTP)[[[MD5]]]] : [[RFC 1321]] で規定されている MD5 算法。
この算法の出力は [[base64]] 符号化を使って符号化する。
: [CODE(HTTP)[[[SHA]]]] : SHA-1 算法。この算法の出力は
base64 符号化を使って符号化する。
: [CODE(HTTP)[[[UNIXsum]]]] : [[単一UNIX仕様書]]第2版で定義されている
[[UNIX]] [KBD[[[sum]]]] 命令で計算される算法。
この算法の出力は16ビット検査和を表現する [[ASCII]]
十進数文字列で、 UNIX [KBD[sum]] 命令の出力の最初の語である。
: [CODE(HTTP)[[[UNIXchecksum]]]] : 単一 UNIX 仕様書第2版で定義されている
UNIX [KBD[[[cksum]]]] 命令で計算される算法。
この算法の出力は32ビット [[CRC]] を表現する [[ASCII]]
数値文字列で、 UNIX [KBD[cksum]] 命令の出力の最初の語である。
> If other digest-algorithm values are defined, the associated encoding
MUST either be represented as a quoted string, or MUST NOT include
";" or "," in the character sets used for the encoding.
他の [CODE(ABNF)[digest-algorithm]] 値が定義される時は、
関連付けられる符号化は[[引用文字列]]として表現されるものであるか、
もしくは符号化に用いられる[[文字集合]]中に [CODE(char)[[[;]]]]
または [CODE(char)[[[,]]]] を含んでは'''ならない'''かでなければ'''なりません'''。
]FIG]
[FIG(quote)[
[FIGCAPTION[
[31] RFC 3230 6 IANA Considerations
]FIGCAPTION]
> The Internet Assigned Numbers Authority (IANA) administers the name
space for digest-algorithm values. Values and their meaning must be
documented in an RFC or other peer-reviewed, permanent, and readily
available reference, in sufficient detail so that interoperability
between independent implementations is possible. Subject to these
constraints, name assignments are First Come, First Served (see RFC 2434 [11]).
インターネット割り当て番号事務局 ([[IANA]])
は [CODE(ABNF)[[[digest-algorithm]]]] 値の名前空間を管理します。
値とその意味は、 [[RFC]] または他のよく評価された、持続的で、
既に入手可能な参照物で、独立な実装が相互運用可能である程度十分詳細に文書化されていなければなりません。
この制約の元、名前割り当ては[[先来先給]]とします
([[RFC 2434]] を参照)。
]FIG]
[32] [[IANA登録簿]]には [Q[(last updated 2002-01-14)]] の時点では [[RFC 3230]]
の4種類のみ登録されていました。
[33] その後 [[RFC 5843]] によって [CODE(HTTP)@en[[[MD5]]]] と [CODE(HTTP)@en[[[SHA]]]]
の定義が更新されると共に、 [CODE(HTTP)@en[[[SHA-256]] と [CODE(HTTP)@en[[[SHA-512]]]]
が追加されています [SRC[>>28]]。
* ハッシュ ([CODE(URI)@en[ni:]], [CODE(URI)@en[nih:]] URL)
** 仕様書
[REFS[
- [3] [CITE@en[RFC 6920 - Naming Things with Hashes]] ([TIME[2014-06-02 05:17:24 +09:00]] 版) <http://tools.ietf.org/html/rfc6920#page-5>
- [12] [CITE@en[RFC 6920 - Naming Things with Hashes]] ([TIME[2014-06-02 05:17:24 +09:00]] 版) <http://tools.ietf.org/html/rfc6920#section-9.4>
- [20] [CITE[Named Information]] ([TIME[2014-01-30 17:45:21 +09:00]] 版) <http://www.iana.org/assignments/named-information/named-information.xhtml#hash-alg>
]REFS]
** 識別
[13] [[ハッシュアルゴリズム]]は [[IANA]] に登録することになっています [SRC[>>12, >>20]]。
[14] [[ハッシュアルゴリズム]]には名前が付けられます。名前は [[URL]]
の構文上は1文字以上の [[RFC 3986]] [CODE(ABNF)@en[[[unreserved]]]] とされていますが、
登録手続き上は制限がありません。 名前は、 [CODE(URI)@en[[[ni:]]]] と
[CODE(URI)@en[[[nih:]]]] で使います。
;; [15] 登録済みの名前はすべて[[ASCII小文字]]と
[[ASCII数字]]と [CODE[[[-]]]] で構成されています。
;; [16] [[Suite ID]] と構文的に区別できるためには、
少なくても63以下の[[整数]]と一致する[[数字]]のみの列の名前が登録されることはなさそうです。
[17] また、 [[Suite ID]] を割り当てられることもあります。これは 0 から 63
までの[[整数]]です。 [SRC[>>12]] [[Suite ID]] は [CODE(URI)@en[[[nih:]]]]
[[URL]] と、[[バイナリ表現]]で使います。
;; [18] 割り当てられないこともあるようですが、既存のものはすべて割り当てられています。
;; [19] いくつかの [[Suite ID]] は予約されています。
** アルゴリズム
[5] [CODE[[[sha-256]]]] を実装し[['''なければなりません''']] [SRC[>>3]]。
[6] それ以外も実装して構いません [SRC[>>3]]。
[7] [[truncated hash]] も実装して構いません [SRC[>>3]]。
;; [8] [[truncated hash]] には、 truncate されていないものと別のアルゴリズム名が与えられています。
** 入力
[9] [[ハッシュアルゴリズム]]への[[入力]]が[[公開鍵]]の値の時は、
[[X.509]] [CODE[[[SubjectPublicKeyInfo]]]] 構造の[[公開鍵]]に対して[[ハッシュ]]を計算する[['''べきです''']]
[SRC[>>3]]。
;; [10] これは主として [[DANE TSLA]] [[プロトコル]]との互換性のために選ばれました。
[11] [[公開鍵]]以外については、何を[[入力]]として使うかは定義されておらず、
[[応用]]依存とされています [SRC[>>3]]。
** 比較
[4] [[ハッシュ値URLの比較]]を参照してください。
* メモ
[1]
[CITE[スラッシュドット ジャパン | MD4/MD5 コリジョンの実証コードが公開]] <http://slashdot.jp/security/05/11/18/0125251.shtml>
([[名無しさん]] [WEAK[2005-11-18 09:36:28 +00:00]])
[2] [CITE[Hash Function FAQ]]
( ([TIME[2008-10-18 14:36:30 +09:00]] 版))
<http://burtleburtle.net/bob/hash/hashfaq.html#unique>