-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviathinksoft-std-0004-mcf1.html
More file actions
292 lines (266 loc) · 17.1 KB
/
Copy pathviathinksoft-std-0004-mcf1.html
File metadata and controls
292 lines (266 loc) · 17.1 KB
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
<!DOCTYPE html>
<html lang="en">
<!-- Contents manually converted using https://markdowntohtml.com/ -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ViaThinkSoft Modular Crypt Format 1.x</title>
<style>
body {
margin: 0;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
line-height: 1.7;
background: #f3f3f3;
color: #222;
}
#content {
max-width: 750px;
margin: 0 auto;
padding: 3rem 2rem;
background: #fff;
}
p {
margin-bottom: 1.2rem;
}
@media (max-width: 768px) {
#content {
max-width: none; /* volle Breite */
padding: 1.5rem 1rem; /* kleiner Rand */
}
}
</style>
</head>
<body>
<p align="center">
<span style="font-family:Verdana">← <a href="index.html">Back to Standards index</a></span>
</p>
<div id="content"><div id="container">
<!-- START -->
<h1 id="viathinksoft-modular-crypt-format-1-0-vts-mcf1-">ViaThinkSoft Modular Crypt Format 1.x (VTS MCF1)</h1>
<h2 id="viathinksoft-webfan-standards-header">ViaThinkSoft/Webfan Standards Header</h2>
<pre><code>VIATHINKSOFT/WEBFAN D. Marschall
SPECIFICATION No. <span class="hljs-number">4</span> ViaThinkSoft
First Draft: <span class="hljs-number">2023</span> <span class="hljs-number">20</span> April <span class="hljs-number">2026</span>
=== ViaThinkSoft Modular Crypt Format 1.x (VTS MCF1) ===
Abstract
This document describes the Modular Crypt Format <span class="hljs-string">"VTS MCF1"</span>, which
allows arbitrary hash values to be expressed <span class="hljs-keyword">and</span> stored using the
standardized MCF string structure.
Identification of this Document
<span class="hljs-symbol">
Revision:</span> <span class="hljs-number">2026</span>-<span class="hljs-number">04</span>-<span class="hljs-number">20</span>
<span class="hljs-symbol"> State:</span> <span class="hljs-keyword">In</span> Force
<span class="hljs-symbol"> Filename:</span> viathinksoft-<span class="hljs-keyword">std</span>-<span class="hljs-number">0004</span>-mcf1.txt
<span class="hljs-symbol"> URN:</span> urn:x-viathinksoft:<span class="hljs-keyword">std</span>:<span class="hljs-number">0004</span>:<span class="hljs-number">2026</span>-<span class="hljs-number">04</span>-<span class="hljs-number">20</span>
<span class="hljs-symbol"> OID:</span> <span class="hljs-number">1.3</span><span class="hljs-meta">.6</span><span class="hljs-meta">.1</span><span class="hljs-meta">.4</span><span class="hljs-meta">.1</span><span class="hljs-meta">.37476</span><span class="hljs-meta">.3</span><span class="hljs-meta">.0</span><span class="hljs-meta">.1</span><span class="hljs-meta">.1</span>
{ iso(<span class="hljs-number">1</span>) identified-organization(<span class="hljs-number">3</span>) dod(<span class="hljs-number">6</span>) internet(<span class="hljs-number">1</span>)
private(<span class="hljs-number">4</span>) enterprise(<span class="hljs-number">1</span>) <span class="hljs-number">37476</span> specifications(<span class="hljs-number">3</span>)
misc(<span class="hljs-number">0</span>) modular-crypt-format(<span class="hljs-number">1</span>) vts-crypt-v1(<span class="hljs-number">1</span>) }
<span class="hljs-symbol"> WEID:</span> P-SX0-<span class="hljs-number">3</span>-<span class="hljs-number">0</span>-<span class="hljs-number">1</span>-<span class="hljs-number">1</span>-<span class="hljs-number">5</span>
IETF/RFC: (None)
Attachments
Reference implementation <span class="hljs-keyword">in</span> PHP:
<span class="hljs-symbol"> https:</span>//github.com/danielmarschall/php_utils/blob/master/
vts_crypt.inc.php
Copyright Notice
Copyright (c) <span class="hljs-number">2023</span>-<span class="hljs-number">2026</span> ViaThinkSoft <span class="hljs-keyword">and</span> the persons identified as
the document authors. All rights reserved.
Licensed under the terms of the Apache <span class="hljs-number">2.0</span> License.
Terminology
The key words <span class="hljs-string">"MUST"</span>, <span class="hljs-string">"MUST NOT"</span>, <span class="hljs-string">"REQUIRED"</span>, <span class="hljs-string">"SHALL"</span>, <span class="hljs-string">"SHALL NOT"</span>,
<span class="hljs-string">"SHOULD"</span>, <span class="hljs-string">"SHOULD NOT"</span>, <span class="hljs-string">"RECOMMENDED"</span>, <span class="hljs-string">"NOT RECOMMENDED"</span>, <span class="hljs-string">"MAY"</span>, <span class="hljs-keyword">and</span>
<span class="hljs-string">"OPTIONAL"</span> <span class="hljs-keyword">in</span> this document are to be interpreted as described <span class="hljs-keyword">in</span>
BCP <span class="hljs-number">14</span> [RFC2119] [RFC8174] when, <span class="hljs-keyword">and</span> only when, they appear <span class="hljs-keyword">in</span> all
capitals, as shown here.
</code></pre><h2 id="introduction-modular-crypt-format-mcf-">Introduction: Modular Crypt Format (MCF)</h2>
<p>The <strong>Modular Crypt Format (MCF)</strong> is a standardized string format used to store password hashes in a self-describing way.
Instead of just storing a raw hash, MCF encodes not only the hash itself but also the algorithm, parameters, and salt—all in a single structured string.
This makes it easier for software systems to verify passwords without needing external metadata.</p>
<h3 id="structure-and-components">Structure and Components</h3>
<p>An MCF string typically follows this general structure:</p>
<pre><code>$id$parameters$salt$hash
</code></pre><ul>
<li><strong><code>$id$</code></strong>: Identifies the hashing algorithm used</li>
<li><strong><code>parameters</code></strong>: Optional settings such as iteration count or memory cost</li>
<li><strong><code>salt</code></strong>: A random value to prevent precomputed attacks (e.g., rainbow tables)</li>
<li><strong><code>hash</code></strong>: The resulting hashed password</li>
</ul>
<p>Not all algorithms use every field, but the structure remains consistent enough to allow parsers to interpret it correctly.</p>
<h3 id="how-mcf-works">How MCF Works</h3>
<p>When a password is hashed using MCF:</p>
<ol>
<li>A hashing algorithm is selected (e.g., MD5, SHA-512, bcrypt).</li>
<li>A random salt is generated.</li>
<li>Optional parameters (like cost factors) are applied.</li>
<li>The hash is computed.</li>
<li>All of this information is encoded into a single MCF string.</li>
</ol>
<p>During verification, the system reads the <code>$id$</code> and parameters from the stored string, recomputes the hash using the same configuration, and compares the results.</p>
<h3 id="standardized-identifiers">Standardized Identifiers</h3>
<p>MCF relies on standardized identifiers to specify the hashing algorithm. Some commonly used ones include:</p>
<ul>
<li><code>$1$</code>: MD5-based crypt</li>
<li><code>$2a$</code>, <code>$2b$</code>, <code>$2y$</code>: bcrypt variants</li>
<li><code>$5$</code>: SHA-256 crypt</li>
<li><code>$6$</code>: SHA-512 crypt</li>
</ul>
<p>These identifiers ensure that systems can correctly interpret which algorithm to use when validating a password.</p>
<h3 id="examples">Examples</h3>
<p>Here are a few example MCF strings:</p>
<ul>
<li><p><strong>MD5 (crypt)</strong></p>
<pre><code>$1$salt123$Wq6u6ZyX1H3QzZ8zYz8Qv/
</code></pre></li>
<li><p><strong>SHA-512 (crypt)</strong></p>
<pre><code>$6$rounds=<span class="hljs-number">5000</span>$salt123$abcdefghijk...
</code></pre></li>
<li><p><strong>bcrypt</strong></p>
<pre><code>$2b$12$e9N1uGkR1l5v9kK3QeJ8eO7uYv5lZk1yYz
</code></pre></li>
</ul>
<p>Each example embeds all required information for verification directly in the string.</p>
<h3 id="oid-based-identification">OID-Based Identification</h3>
<p>In addition to traditional identifiers like <code>$1$</code>, a more formal approach to defining MCF schemes is described in a book that assigns each format a unique <strong>Object Identifier (OID)</strong>.</p>
<p>An <strong>OID</strong> is a globally unique hierarchical identifier used to name objects in a standardized way.</p>
<p>By associating each MCF variant with an OID, this system ensures there are no naming conflicts between different hashing schemes, even across independent implementations or future extensions.</p>
<h2 id="introduction-about-viathinksoft-modular-crypt-format-1-x-vts-mcf1-">Introduction: About ViaThinkSoft Modular Crypt Format 1.x (VTS MCF1)</h2>
<h2 id="viathinksoft-modular-crypt-format">ViaThinkSoft Modular Crypt Format</h2>
<p>The <strong>ViaThinkSoft Modular Crypt Format</strong> is a Modular Crypt Format (MCF) variant identified by the Object Identifier (OID) <strong>1.3.6.1.4.1.37476.3.0.1.1</strong>.</p>
<ul>
<li><p>ViaThinkSoft MCF was introduced to represent existing password hashes in a standardized MCF string form. Legacy hashes (e.g., salted MD5) can be converted into the <code>$...$...$</code> structure, allowing them to be stored alongside other MCF-based passwords in the same data structure. This supports uniform handling of both legacy and newer formats and enables gradual migration, where old hashes remain valid until they are replaced with stronger ones upon successful authentication.</p>
</li>
<li><p>It also allows the use of algorithms that do not have a predefined MCF identifier. For example, hashes such as SHA3-512 can be encoded using ViaThinkSoft MCF 1.x, making it possible to store them in MCF notation together with other password hashes.</p>
</li>
</ul>
<h3 id="format-of-vts-mcf1-">Format of VTS MCF1:</h3>
<h4 id="structure">Structure</h4>
<pre><code> $<span class="hljs-number">1.3</span><span class="hljs-number">.6</span><span class="hljs-number">.1</span><span class="hljs-number">.4</span><span class="hljs-number">.1</span><span class="hljs-number">.37476</span><span class="hljs-number">.3</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span><span class="hljs-number">.1</span>$a=<algo>[,ai=<algo-internal>],m=<mode>[,i=<iterations>]$<salt>$<hash>
</code></pre><h4 id="parameter-a-algo-and-ai-algo-internal-">Parameter <code>a=<algo></code> and <code>ai=<algo-internal></code></h4>
<p><code>a</code> and <code>ai</code> are any valid hash algorithm (name scheme of PHP <code>hash_algos()</code> preferred), e.g.</p>
<ul>
<li><code>sha3-512</code></li>
<li><code>sha3-384</code></li>
<li><code>sha3-256</code></li>
<li><code>sha3-224</code></li>
<li><code>sha512</code></li>
<li><code>sha512/256</code></li>
<li><code>sha512/224</code></li>
<li><code>sha384</code></li>
<li><code>sha256</code></li>
<li><code>sha224</code></li>
<li><code>sha1</code></li>
<li><code>md5</code></li>
</ul>
<p>NOT possible with VTS MCF are these hashes (because they have a special salt-handling and output their own crypt format):</p>
<ul>
<li><code>bcrypt</code> [Standardized crypt identifier <code>2</code>, <code>2a</code>, <code>2b</code>, <code>2x</code>, or <code>2y</code>]</li>
<li><code>argon2i</code> [Crypt identifier <code>argon2i</code>, not standardized]</li>
<li><code>argon2id</code> [Crypt identifier <code>argon2id</code>, not standardized]</li>
</ul>
<p><code>ai=<algo-internal></code> is only required if <code>m=<mode></code> uses the <code>hash[...]</code> formula (see below) and can be omitted if it is equal to <code>a=<algo></code>.</p>
<h4 id="parameter-m-mode-">Parameter <code>m=<mode></code></h4>
<p>In VTS MCF 1.0, the mode can be one of these:</p>
<ul>
<li><code>sp</code>: salt + password<ul>
<li>Deprecated. Use instead: <code>hash[sp]</code>, it behaves equal if <code>i=0</code></li>
</ul>
</li>
<li><code>ps</code>: password + salt<ul>
<li>Deprecated. Use instead: <code>hash[ps]</code>, it behaves equal if <code>i=0</code></li>
</ul>
</li>
<li><code>sps</code>: salt + password + salt<ul>
<li>Deprecated. Use instead: <code>hash[sps]</code>, it behaves equal if <code>i=0</code></li>
</ul>
</li>
<li><code>shp</code>: salt + Hash(password)<ul>
<li>Deprecated. Use instead: <code>hash[shbx(p)]</code>, it behaves equal if <code>i=0</code> and <code>a=ai</code></li>
</ul>
</li>
<li><code>hps</code>: Hash(password) + salt<ul>
<li>Deprecated. Use instead: <code>hash[hbx(p)s]</code>, it behaves equal if <code>i=0</code> and <code>a=ai</code></li>
</ul>
</li>
<li><code>shps</code>: salt + Hash(password) + salt<ul>
<li>Deprecated. Use instead: <code>hash[shbx(p)s]</code>, it behaves equal if <code>i=0</code> and <code>a=ai</code></li>
</ul>
</li>
<li><code>hmac</code>: HMAC (salt is the key)<ul>
<li>Deprecated. Use instead: <code>hmac[s;p]</code>, it behaves equal if <code>i=0</code></li>
</ul>
</li>
<li><code>pbkdf2</code>: PBKDF2-HMAC<ul>
<li>Deprecated. Use instead: <code>pbkdf2[s;p]</code></li>
<li>Additional param <code>i</code> contains the number of iterations)</li>
</ul>
</li>
</ul>
<p>In MCF 1.1, the following modes were added:</p>
<ul>
<li><code>hmac[<formula for key>;<formula for payload>]</code></li>
<li><code>pbkdf2[<formula for salt>;<formula for payload>]</code></li>
<li><code>hash[<formula for payload>]</code><ul>
<li>Note: The algorithm for these nested hashes is <code><algo-internal></code> and not <code><algo></code></li>
</ul>
</li>
</ul>
<p>The formulas for the new modes in VTS MCF 1.1 can be any custom formula with the following elements:</p>
<ul>
<li><code>hbx(...)</code> means hash binary</li>
<li><code>hhu(...)</code> means hash hex upper</li>
<li><code>hhl(...)</code> means hash hex lower</li>
<li><code>h64(...)</code> means hash base64</li>
<li><code>s</code> means salt</li>
<li><code>p</code> means password</li>
</ul>
<p>Example: <code>m=hash[shbx(sp)]</code> means that the hash will be <code>Hash(Salt+Hash(Salt+Password))</code>.</p>
<h4 id="parameter-i-iterations-">Parameter <code>i=<iterations></code></h4>
<p>The parameter <code>i</code> can be omitted if 0.</p>
<p>It is required for <code>m=pbkdf2</code> and <code>m=pbkdf2[...]</code>.</p>
<p>For other modes it is optional, and implemented as follows:</p>
<ul>
<li>For VTS MCF 1.0 (modes <code>sp</code>, <code>ps</code>, <code>sps</code>, <code>shp</code>, <code>hps</code>, <code>shps</code>, or <code>hmac</code>): It repeats the hash/hmac operation with the password being replaced with the previous hash output concatenated with the iteration number starting with 0.</li>
<li>For VTS MCF 1.1 (modes <code>hash[...]</code>, <code>hmac[...]</code>, or <code>pbkdf2[...]</code>): It repeats the hash/hmac operation with the password being replaced with the previous hash output.</li>
</ul>
<h4 id="alphabet-of-salt-and-hash">Alphabet of salt and hash</h4>
<p>Like most Crypt-hashes, <salt> and <hash> are Radix64 coded with alphabet './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' and no padding.</p>
<h3 id="links">Links</h3>
<p>Link to the online specification:
<a href="https://www.viathinksoft.de/std/viathinksoft-std-0004-mcf1.html">https://www.viathinksoft.de/std/viathinksoft-std-0004-mcf1.html</a></p>
<p>Reference implementation in PHP:
<a href="https://github.com/danielmarschall/php_utils/blob/master/vts_crypt.inc.php">https://github.com/danielmarschall/php_utils/blob/master/vts_crypt.inc.php</a></p>
<h3 id="test-vectors">Test Vectors</h3>
<p>Test vector 1:</p>
<ul>
<li>Input: <code>Hello World</code></li>
<li>Hash: <code>$1.3.6.1.4.1.37476.3.0.1.1$a=sha3- 256,m=sp$$2Ud0hUTh//swVxoilAltWQ/9LQ189eZcdJ/hA5HkV/C</code></li>
<li>Algorithm: SHA3-256</li>
<li>Mode: sp (Salt || Password)</li>
<li>Salt: None</li>
</ul>
<p>Test vector 2:</p>
<ul>
<li>Input: Hello World</li>
<li>Hash: <code>$1.3.6.1.4.1.37476.3.0.1.1$a=sha3- 256,m=sp$CAT/9cvgCuS$dqNf5hJf0p09lYx.9rvI/c96swTz58tGhipuhobl8Ke</code></li>
<li>Algorithm: SHA3-256</li>
<li>Mode: sp (Salt || Password)</li>
<li>Salt: 8 Bytes</li>
</ul>
<h2 id="security-considerations">Security Considerations</h2>
<p>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. Marschall [Page 4]</p>
<h2 id="ra-considerations">RA Considerations</h2>
<ul>
<li>OID: <code>1.3.6.1.4.1.37476.3.0.1.1</code></li>
<li>ASN1: <code>{ iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 37476 specifications(3) misc(0) modular-crypt-format(1) vts-crypt-v1(1) }</code></li>
<li>IRI: <code>/.../Specifications/Misc/ModularCryptFormat/VtsCryptV1</code></li>
<li>WEID: <code>P-SX0-3-0-1-1-5</code></li>
</ul>
<h2 id="references">References</h2>
<h3 id="normative-references">Normative References</h3>
<p>[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", <a href="https://datatracker.ietf.org/doc/html/bcp14">BCP 14</a>, <a href="https://datatracker.ietf.org/doc/html/rfc2119">RFC 2119</a>, DOI 10.17487/RFC2119, March 1997, <a href="[https://www.rfc-editor.org/info/rfc2119](https://www.rfc-editor.org/info/rfc2119)">[https://www.rfc-editor.org/info/rfc2119](https://www.rfc-editor.org/info/rfc2119)</a>.</p>
<h3 id="informative-references">Informative References</h3>
<p>None</p>
<!-- END -->
</div></div>
</body>
</html>