-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviathinksoft-std-0005-mha1.nroff
420 lines (350 loc) · 12.3 KB
/
viathinksoft-std-0005-mha1.nroff
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
.\" This document was created using "Nroff Internet Draft Editor"
.\" Note that a hotfix is required to use this program after 1st January 2020:
.\" https://misc.daniel-marschall.de/patches/nroffedit/
.\"
.\" Alternative, you can compile this document on Linux, using the following command:
.\" nroff -T ascii -ms viathinksoft-std-0005-mha1.nroff | ./fix_formfeed.pl > viathinksoft-std-0005-mha1.txt
.\" Note that "-ms" only works if the package "groff" is installed.
.\" fix.pl needs to be executed to replace FORMFEED.
.\" Note that the Linux command does not auto-generate the Table of Contents, since this is a NroffEdit feature!
.\"
.\" Note about section titles: According to RFC7322, the section capitalization should be Chicago Manual of Style
.\" Use this tool: https://titlecaseconverter.com/
.\"
.\" These values are required for my Debian Linux system (nroff) so that it outputs the same lines like NroffEdit
.pl 95n
.nr HM 6n
.nr FM 8n
.\" Page length
.\".pl 10.0i
.\" Page offset
.po 0
.\" Length of line
.ll 7.2i
.\" Length of title
.lt 7.2i
.\" Line Length (ms macro)
.nr LL 7.2i
.\" Title line length
.nr LT 7.2i
.\" Left footer text
.ds LF Marschall
.\" Right footer text. "FORMFEED" will be replaced by a post-processing script.
.ds RF FORMFEED[Page %]
.\" Left header text
.ds LH VTS/WF STD. 5
.\" Right header text
.ds RH 4 September 2024
.\" Center header text
.ds CH ViaThinkSoft MHA1
.\" Center footer text
.ds CF
.\" Hyphenation mode set to 0
.hy 0
.\" Disable hyphenation
.nh
.\" Adjust text left
.ad l
.\" Set indent (can be overridden for a single line using .ti = temporary indent)
.in 0
.nf
.tl 'VIATHINKSOFT/WEBFAN''D. Marschall'
.tl 'SPECIFICATION No. 5''ViaThinkSoft'
.tl 'First Draft: 2011''4 September 2024'
.fi
.\" Note. The ".tl" directive is used to generate the leading header
.\" in Internet drafts. The information specified after ".tl" provides
.\" left, center and right components of a line separated by the ' character
.\" in the following manner:
.\"
.\" .tl '<left component>'<center component>'<right component>'
.\"
.\" Only the left and right components are used in Internet-draft headers
.\" This and other comments in this template can safely be deleted.
.ce 3
=== Marschall Hash 1 (MHA1) ===
.fi
.in 3
.ti 0
Abstract
This document describes the hash algorithm MHA1.
.ti 0
Identification of this Document
.in 3
.nf
Revision: 2024-09-04
State: Deprecated
Filename: viathinksoft-std-0005-mha1.txt
URN: urn:x-viathinksoft:std:0005:2024-09-04
OID: 1.3.6.1.4.1.37476.3.2.1.1
{ iso(1) identified-organization(3) dod(6) internet(1)
private(4) enterprise(1) 37476 specifications(3)
algorithm(2) hash(1) mha1(1) }
WEID: weid:pen:SX0-3-2-1-1-1
IETF/RFC: (None)
.fi
.ti 0
Attachments
Reference implementation in PHP:
https://github.com/danielmarschall/php_utils/blob/master/\\
vts_crypt.inc.php
.ti 0
Copyright Notice
Copyright (c) 2011-2024 ViaThinkSoft and the persons identified as the
document authors. All rights reserved.
Licensed under the terms of the Apache 2.0 License.
.br
.\" These values are required for my Debian Linux system (nroff) so that it outputs the same lines like NroffEdit
.nr HM 8n
.nr FM 8n
.bp
.pl 96n
.\" \# TD4 -- Set TOC depth by altering this value (TD5 = depth 5)
.\" \# TOC -- Beginning of auto updated Table of Contents
.in 0
Table of Contents
.nf
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 Terminology . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.1 Modular Crypt Format Notation . . . . . . . . . . . . . . . 3
3.2 Heterogenous Systems Notation . . . . . . . . . . . . . . . 4
4 Test Vectors . . . . . . . . . . . . . . . . . . . . . . . . . 5
5 Reference implementation . . . . . . . . . . . . . . . . . . . 6
6 Security Considerations . . . . . . . . . . . . . . . . . . . . 6
6.1 Runtime complexity . . . . . . . . . . . . . . . . . . . . 6
7 RA Considerations . . . . . . . . . . . . . . . . . . . . . . . 6
8 References . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.1 Normative References . . . . . . . . . . . . . . . . . . . 8
6.2 Informative References . . . . . . . . . . . . . . . . . . 8
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . 8
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 8
.fi
.in 3
.\" \# ETC -- End of auto updated Table of Contents
.bp
.ti 0
1 Introduction
MHA is a hash function which performs multiple hash iterations on a base hash function. It should be save even if the base hash function is broken. This function is pretty slow because of the iterations, but therefore secure against offline attacks or rainbowtables. Also, the slowlyness of this hash makes the creation of rainbow tables much harder.
.ti 0
1.1 Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP\014 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
.ti 0
2 Definition
.nf
MHA(x, iteratedSalt, iterations)
= rec(iterations, x, iteratedSalt).
rec[n, x, iteratedSalt]
= iteratedSalt || rec[n-1, x, iteratedSalt] || iteratedSalt.
rec[0, x, iteratedSalt]
= x.
.fi
.ti 0
3 Notation
.ti 0
3.1 Modular Crypt Format Notation
Format of the MCF:
.nf
$<id>$<params>$<salt>$<hash>
.fi
<id> is 1.3.6.1.4.1.37476.3.2.1.1
<params> is a=<algo>,i=<iterations>
where <algo> is any valid hash algorithm (name scheme of PHP hash_algos() preferred), e.g.
.nf
- sha3-512
- sha3-384
- sha3-256
- sha3-224
- sha512
- sha512/256
- sha512/224
- sha384
- sha256
- sha224
- sha1
- md5
.fi
Not possible with MHA1 are these hashes (because they have a special salt-handling and output their own crypt format):
.nf
- bcrypt [Standardized crypt identifier 2, 2a, 2x, 2y]
- argon2i [Crypt identifier argon2i, not standardized]
- argon2id [Crypt identifier argon2i, not standardized]
.fi
<iterations> are the iterations.
Like most Crypt-hashes, <salt> and <hash> are Radix64 coded
without padding and with alphabet
'./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.
.ti 0
3.2 Heterogenous Systems Notation
The "heterogenous systems notation" (HSN) is DEPRECATED in favor of the modular crypt format notation!
<mha1-oid>$<base-hash>$<iterations>$<salt-base64>$<hash-base64>
- <mha1-oid> is the OID for a MHA1 algorithm in its dot-notation without leading dot,
which is 1.3.6.1.4.1.37476.3.2.1.1
This OID has ASN.1 Notation:
{ iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1)
37476 specification(3) algorithm(2) hash(1) mha1(1) }
- <base-hash> should be an OID which represents the base hash ("H") algorithm used, in dot-notation.
The following table shows the OIDs which have been assigned
for exchange between heterogenous systems. If you want to use a different
hash algorithm or a derivate of it, please define your own OID
(you can use an UUID OID, get a free IANA PEN OID, or a free ViaThinkSoft OID),
but please do not use this arc, since only ViaThinkSoft may maintain it.
.nf
--------------------------------------------------------------
Base algorithm OID proposal
--------------------------------------------------------------
Message Digest 4 (MD4) 1.3.6.1.4.1.37476.3.2.1.99.1
Message Digest 5 (MD5) 1.3.6.1.4.1.37476.3.2.1.99.2
RIPEMD-160 1.3.6.1.4.1.37476.3.2.1.99.3
Secure Hash Algorithm 1.3.6.1.4.1.37476.3.2.1.99.4
Secure Hash Algorithm 1 1.3.6.1.4.1.37476.3.2.1.99.5
Secure Hash Algorithm 2/224 1.3.6.1.4.1.37476.3.2.1.99.6.224
Secure Hash Algorithm 2/256 1.3.6.1.4.1.37476.3.2.1.99.6.256
Secure Hash Algorithm 2/384 1.3.6.1.4.1.37476.3.2.1.99.6.384
Secure Hash Algorithm 2/512 1.3.6.1.4.1.37476.3.2.1.99.6.512
Secure Hash Algorithm 3/224 1.3.6.1.4.1.37476.3.2.1.99.7.224
Secure Hash Algorithm 3/256 1.3.6.1.4.1.37476.3.2.1.99.7.256
Secure Hash Algorithm 3/384 1.3.6.1.4.1.37476.3.2.1.99.7.384
Secure Hash Algorithm 3/512 1.3.6.1.4.1.37476.3.2.1.99.7.512
--------------------------------------------------------------
.fi
- <iterations> is the number of iterations, e.g. 1987.
- <salt-base64> is the iterated salt used for MHA1, encoded in Base64.
- <hash-base64> is the resulting hash, encoded in Base64.
.ti 0
4 Test Vectors
.nf
MHA1 - Base algo 'sha1', Input '', Salt '', Iterations 1987
MCF: $1.3.6.1.4.1.37476.3.2.1.1$a=sha1,i=1987$$SMJt5BeI3z2Q577
2DcQUXiFBHmO
HSN: 1.3.6.1.4.1.37476.3.2.1.1$1.3.6.1.4.1.37476.3.2.1.99.5$19
87$$UOLv7DgK5/4S7994FeSWZkHDJoQ=
Hex: 50e2efec380ae7fe12efdf7815e4966641c32684
MHA1 - Base algo 'sha1',
Input 'The quick brown fox jumps over the lazy dog',
Salt '', Iterations 1987
MCF: $1.3.6.1.4.1.37476.3.2.1.1$a=sha1,i=1987$$9obb16qgeksp9r4
iSz.o77EUQlC
HSN: 1.3.6.1.4.1.37476.3.2.1.1$1.3.6.1.4.1.37476.3.2.1.99.5$19
87$$Bqdd38sigmurBt6kU/0q99GWSnE=
Hex: 06a75ddfcb22826bab06dea453fd2af7d1964a71
.fi
.bp
.ti 0
5 Reference implementation
.nf
// Implementation in PHP, with hex output
function mha1($password, $iteratedSalt, $iterations, $base_algo) {
assert($iterations >= 1);
$m = $password;
for ($i=1; $i<=$iterations; $i++) {
$m = hash($base_algo,
$iteratedSalt.$m.$iteratedSalt, true/*binary*/);
}
return bin2hex($m);
}
// Framework for PHP, with MCF output and auto-generated salt:
// https://github.com/danielmarschall/php_utils/blob/master/
// vts_crypt.inc.php
include 'vts_crypt.inc.php';
$hash = vts_password_hash($data, PASSWORD_VTS_MHA1,
['algo'=>'sha1', 'salt_length'=>16, 'iterations'=>1987]);
assert(vts_password_verify($data, $hash));
.fi
.ti 0
6 Security Considerations
Hash values play a crucial role in various security contexts, such as password verification. For detailed guidance on securely managing hashes, please consult the relevant literature or documentation.
MHA1 might be prone to collisions because the probability of collisions increases with the iterations.
.ti 0
6.1 Runtime complexity
The number of hash OPs is <iterations>.
.ti 0
7 RA Considerations
.nf
OID: 1.3.6.1.4.1.37476.3.2.1.1
WEID: weid:pen:SX0-3-2-1-1-1
ASN1: { iso(1) identified-organization(3) dod(6) internet(1)
private(4) enterprise(1) 37476 specifications(3)
algorithm(2) hash(1) mha1(1)|mha-family(1) }
IRI: /.../Specifications/Algorithm/Hash/MHA1|MHA-Family
.bp
Deprecated children:
+ mha(0), IRI MHA
+ ... illegal(0)
+ ... mha-1987(1987)
+ ... ... binary(0)
+ ... ... base64(1)
+ ... ... hexadecimal(2)|base16(2)
+ md5mha(1), IRI Md5MHA
+ ... illegal(0)
+ ... md5mha-1987(1987)
+ ... ... binary(0)
+ ... ... base64(1)
+ ... ... hexadecimal(2)|base16(2)
OID: 1.3.6.1.4.1.37476.3.2.1.99
ASN1: { iso(1) identified-organization(3) dod(6) internet(1)
private(4) enterprise(1) 37476 specifications(3) algorithm(2)
hash(1) foreign(99) }
IRI: /.../Specifications/Algorithm/Hash/Foreign
WEID: weid:pen:SX0-3-2-1-2R-2
Children:
+ md4(1), IRI MD4
+ md5(3), IRI MD5
+ ripemd160(3), IRI RIPEMD-160
+ sha0(4), IRI SHA0
+ sha1(5), IRI SHA1
+ sha2(6), IRI SHA2
+ ... 224
+ ... 256
+ ... 384
+ ... 512
+ ... ... 224
+ ... ... 256
+ sha3(7), IRI SHA3
+ ... 224
+ ... 256
+ ... 384
+ ... 512
+ shake(8), IRI SHAKE
+ ... 128
+ ... 256
.fi
.bp
.ti 0
8 References
.ti 0
6.1 Normative References
.in 14
.\" https://www.rfc-editor.org/refs/ref2119.txt
.ti 3
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP\014, RFC\02119, DOI\010.17487/RFC2119, March\01997,
.br
<https://www.rfc-editor.org/info/rfc2119>.
.in 3
.ti 0
6.2 Informative References
.in 14
.ti 3
None
.in 3
.ti 0
Acknowledgements
.in 3
I would like to thank Melanie Wehowski for her long time support in OIDplus and WEID projects.
This document was written in Nroff Internet Draft Editor by 3xA Security.
.br
https://aaa-sec.com/nroffedit/
.br
https://misc.daniel-marschall.de/patches/nroffedit/ ("year 2020" patch)
.ti 0
Authors' Addresses
.in 3
.nf
Daniel Marschall
Postfach 11 53
69243 Bammental
Germany
Email: [email protected]
URI: https://www.viathinksoft.com/
.fi