Subversion Repositories uuid_mac_utils

Rev

Rev 60 | Rev 62 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
31 daniel-mar 1
<?php
2 daniel-mar 2
 
31 daniel-mar 3
/*
4
* UUID & MAC Utils
5
* Copyright 2017 - 2023 Daniel Marschall, ViaThinkSoft
57 daniel-mar 6
* Version 2023-08-02
31 daniel-mar 7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
*     http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*/
20
 
21
include_once __DIR__.'/includes/uuid_utils.inc.php';
22
 
23
const AUTO_NEW_UUIDS = 10;
24
 
25
?><!DOCTYPE html>
26
<html lang="en">
27
 
2 daniel-mar 28
<head>
29
        <meta charset="iso-8859-1">
30
        <link rel="stylesheet" type="text/css" href="style.css">
31
        <title>UUID &amp; MAC Utils by Daniel Marschall</title>
35 daniel-mar 32
        <meta name=viewport content="width=device-width, initial-scale=1">
2 daniel-mar 33
</head>
34
 
35
<body>
36
 
25 daniel-mar 37
<h1>UUID &amp; MAC Utils by Daniel Marschall</h1>
2 daniel-mar 38
 
12 daniel-mar 39
<p><a href="https://github.com/danielmarschall/uuid_mac_utils/">View the source code</a></p>
2 daniel-mar 40
 
31 daniel-mar 41
<h2>Overview</h2>
2 daniel-mar 42
 
31 daniel-mar 43
<ul>
44
    <li><a href="#gen_uuid">Generate random and/or time-based UUIDs</a><ul>
45
            <li><a href="#gen_uuidv7"><font color="green">New:</font> Generate Unix Epoch Time (version 7) UUID</a></li>
46
            <li><a href="#gen_uuidv6"><font color="green">New:</font> Generate reordered time-based (version 6) UUID</a></li>
47
            <li><a href="#gen_uuidv4">Generate random (version 4) UUID</a></li>
48
            <li><a href="#gen_uuidv1">Generate time-based (version 1) UUID</a></li>
49
        </ul></li>
50
    <li><a href="#gen_other_uuid">Generate other UUID types</a><ul>
53 daniel-mar 51
            <li><a href="#gen_uuid_ncs">NCS (variant 0) UUID</a></li>
31 daniel-mar 52
            <li><a href="#gen_uuidv2">Generate DCE Security (version 2) UUID</a></li>
61 daniel-mar 53
            <li><a href="#gen_uuidv35">Generate name-based (version 3 / 5 / <font color="green">New: 8</font>) UUID</a></li>
54
            <li><a href="#gen_uuidv8"><font color="green">New:</font> Generate Custom (version 8) UUID</a></li>
31 daniel-mar 55
        </ul></li>
56
    <li><a href="#interpret_uuid">Interpret a UUID</a></li>
41 daniel-mar 57
    <li><a href="#interpret_mac">Interpret a MAC address (MAC / EUI / ELI / SAI / AAI)</a><ul>
58
        <li><a href="#gen_aai">Generate an AAI</a></li>
59
    </ul></li>
31 daniel-mar 60
</ul>
2 daniel-mar 61
 
31 daniel-mar 62
<h2 id="gen_uuid">Generate random and/or time-based UUIDs</h2>
30 daniel-mar 63
 
31 daniel-mar 64
<h3 id="gen_uuidv7"><font color="green">New:</font> Generate Unix Epoch Time (version 7) UUID &#11088</h3>
65
 
35 daniel-mar 66
<p><i>A UUIDv7 is made of time and 74 random&nbsp;bits.
31 daniel-mar 67
        Since the time is at the beginning, the UUIDs are monotonically increasing.
68
        Due to the missing MAC address, this UUID version is recommended due to
69
        improved privacy.</i></p>
70
 
35 daniel-mar 71
<p><a id="uuidv7_info_button" href="javascript:show_uuidv7_info()">Show format</a>
72
<script>
73
function show_uuidv7_info() {
74
        document.getElementById("uuidv7_info_button").style.display = "none";
75
        document.getElementById("uuidv7_info").style.display = "block";
76
}
77
</script>
78
<pre id="uuidv7_info" style="display:none">Variant 1, Version 7 UUID:
37 daniel-mar 79
- 48 bit <abbr title="Count of 1ms intervals passed since 1 Jan 1970 00:00:00 GMT">Unix Time in milliseconds</abbr>
35 daniel-mar 80
-  4 bit Version (fix 0x7)
81
- 12 bit Random
82
-  2 bit Variant (fix 0b10)
83
- 62 bit Random</pre></p>
84
 
31 daniel-mar 85
<?php
86
if (AUTO_NEW_UUIDS > 0) { /** @phpstan-ignore-line */
35 daniel-mar 87
        echo '<p>Here are '.AUTO_NEW_UUIDS.' UUIDs that were created just for you! (Reload the page to get more)</p>';
31 daniel-mar 88
 
89
        echo '<pre>';
90
        for ($i=0; $i<10; $i++) {
91
                $uuid = gen_uuid_v7();
92
                echo '<a href="interprete_uuid.php?uuid='.$uuid.'">'.$uuid.'</a><br>';
93
        }
94
        echo '</pre>';
95
}
96
?>
97
 
2 daniel-mar 98
<form method="GET" action="interprete_uuid.php">
31 daniel-mar 99
    <input type="hidden" name="version" value="7">
100
    <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Create and display another UUID">
2 daniel-mar 101
</form>
102
 
32 daniel-mar 103
<h3 id="gen_uuidv6"><font color="green">New:</font> Generate reordered time-based (version 6) UUID &#9200;</h3>
2 daniel-mar 104
 
31 daniel-mar 105
<p><i>Like UUIDv1, this kind of UUID is made of the MAC address of the generating computer,
106
        the time, and a clock sequence. However, the components in UUIDv6 are reordered (time is at the beginning),
107
        so that UUIDs are monotonically increasing.</i></p>
2 daniel-mar 108
 
35 daniel-mar 109
<p><a id="uuidv6_info_button" href="javascript:show_uuidv6_info()">Show format</a>
110
<script>
111
function show_uuidv6_info() {
112
        document.getElementById("uuidv6_info_button").style.display = "none";
113
        document.getElementById("uuidv6_info").style.display = "block";
114
}
115
</script>
116
<pre id="uuidv6_info" style="display:none">Variant 1, Version 6 UUID:
37 daniel-mar 117
- 48 bit High <abbr title="Count of 100ns intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
35 daniel-mar 118
-  4 bit Version (fix 0x6)
37 daniel-mar 119
- 12 bit Low <abbr title="Count of 100ns intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
35 daniel-mar 120
-  2 bit Variant (fix 0b10)
121
-  6 bit Clock Sequence High
122
-  8 bit Clock Sequence Low
123
- 48 bit MAC Address</pre></p>
124
 
31 daniel-mar 125
<?php
126
if (AUTO_NEW_UUIDS > 0) { /** @phpstan-ignore-line */
35 daniel-mar 127
        echo '<p>Here are '.AUTO_NEW_UUIDS.' UUIDs that were created just for you! (Reload the page to get more)</p>';
31 daniel-mar 128
 
129
        echo '<pre>';
130
        for ($i=0; $i<10; $i++) {
131
                $uuid = gen_uuid_v6();
132
                echo '<a href="interprete_uuid.php?uuid='.$uuid.'">'.$uuid.'</a><br>';
133
        }
134
        echo '</pre>';
135
}
136
?>
137
 
2 daniel-mar 138
<form method="GET" action="interprete_uuid.php">
31 daniel-mar 139
    <input type="hidden" name="version" value="6">
140
    <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Create and display another UUID">
30 daniel-mar 141
</form>
142
 
31 daniel-mar 143
<h3 id="gen_uuidv4">Generate random (version 4) UUID &#x1F3B2;</h3>
30 daniel-mar 144
 
35 daniel-mar 145
<p><i>A UUIDv4 is made of 122 random&nbsp;bits. No other information is encoded in this kind of UUID.</i></p>
30 daniel-mar 146
 
35 daniel-mar 147
<p><a id="uuidv4_info_button" href="javascript:show_uuidv4_info()">Show format</a>
148
<script>
149
function show_uuidv4_info() {
150
        document.getElementById("uuidv4_info_button").style.display = "none";
151
        document.getElementById("uuidv4_info").style.display = "block";
152
}
153
</script>
154
<pre id="uuidv4_info" style="display:none">Variant 1, Version 4 UUID:
155
- 48 bit Random High
156
-  4 bit Version (fix 0x4)
157
- 12 bit Random Mid
158
-  2 bit Variant (fix 0b10)
159
- 62 bit Random Low</pre></p>
160
 
31 daniel-mar 161
<?php
162
if (AUTO_NEW_UUIDS > 0) { /** @phpstan-ignore-line */
35 daniel-mar 163
        echo '<p>Here are '.AUTO_NEW_UUIDS.' UUIDs that were created just for you! (Reload the page to get more)</p>';
31 daniel-mar 164
 
165
        echo '<pre>';
166
        for ($i=0; $i<10; $i++) {
167
                $uuid = gen_uuid_v4();
168
                echo '<a href="interprete_uuid.php?uuid='.$uuid.'">'.$uuid.'</a><br>';
169
        }
170
        echo '</pre>';
171
}
172
?>
173
 
30 daniel-mar 174
<form method="GET" action="interprete_uuid.php">
31 daniel-mar 175
    <input type="hidden" name="version" value="4">
176
    <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Create and display another UUID">
30 daniel-mar 177
</form>
178
 
32 daniel-mar 179
<h3 id="gen_uuidv1">Generate time-based (version 1) UUID &#9200;</h3>
30 daniel-mar 180
 
31 daniel-mar 181
<p><i>A UUIDv1 is made of the MAC address of the generating computer,
182
the time, and a clock sequence.</i></p>
30 daniel-mar 183
 
35 daniel-mar 184
<p><a id="uuidv1_info_button" href="javascript:show_uuidv1_info()">Show format</a>
185
<script>
186
function show_uuidv1_info() {
187
        document.getElementById("uuidv1_info_button").style.display = "none";
188
        document.getElementById("uuidv1_info").style.display = "block";
189
}
190
</script>
191
<pre id="uuidv1_info" style="display:none">Variant 1, Version 1 UUID:
37 daniel-mar 192
- 32 bit Low <abbr title="Count of 100ns intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
193
- 16 bit Mid <abbr title="Count of 100ns intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
35 daniel-mar 194
-  4 bit Version (fix 0x1)
37 daniel-mar 195
- 12 bit High <abbr title="Count of 100ns intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
35 daniel-mar 196
-  2 bit Variant (fix 0b10)
197
-  6 bit Clock Sequence High
198
-  8 bit Clock Sequence Low
199
- 48 bit MAC Address</pre></p>
200
 
31 daniel-mar 201
<?php
202
if (AUTO_NEW_UUIDS > 0) { /** @phpstan-ignore-line */
35 daniel-mar 203
    echo '<p>Here are '.AUTO_NEW_UUIDS.' UUIDs that were created just for you! (Reload the page to get more)</p>';
31 daniel-mar 204
 
205
    echo '<pre>';
206
    for ($i=0; $i<10; $i++) {
207
        $uuid = gen_uuid_v1();
208
        echo '<a href="interprete_uuid.php?uuid='.$uuid.'">'.$uuid.'</a><br>';
209
    }
210
    echo '</pre>';
211
}
212
?>
213
 
30 daniel-mar 214
<form method="GET" action="interprete_uuid.php">
31 daniel-mar 215
    <input type="hidden" name="version" value="1">
216
    <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Create and display another UUID">
30 daniel-mar 217
</form>
218
 
31 daniel-mar 219
<h2 id="gen_other_uuid">Generate other UUID types</h2>
30 daniel-mar 220
 
47 daniel-mar 221
<p><i>The following types of UUIDs are less common and/or require special knowledge. Please only use the following
30 daniel-mar 222
generators if you know what you are doing.</i></p>
223
 
53 daniel-mar 224
<h3 id="gen_uuid_ncs">NCS (variant 0) UUID</h3>
30 daniel-mar 225
 
53 daniel-mar 226
<p>The <abbr title="Network Computing System">NCS</abbr> UUIDs are a legacy format
227
initially designed by Apollo Computer that cannot be generated anymore, because the
30 daniel-mar 228
amount of available timestamp bits was exhausted on <strong>5 September 2015</strong>.
53 daniel-mar 229
As an example, here is the last possible NCS UUID (all bits of the timestamp are set to 1) for IP address 127.0.0.1:
34 daniel-mar 230
<a href="interprete_uuid.php?uuid=ffffffff-ffff-0000-027f-000001000000"><code>ffffffff-ffff-0000-027f-000001000000</code></a>.</p>
30 daniel-mar 231
 
35 daniel-mar 232
<p><a id="uuidnce_info_button" href="javascript:show_uuidnce_info()">Show format</a>
233
<script>
234
function show_uuidnce_info() {
235
        document.getElementById("uuidnce_info_button").style.display = "none";
236
        document.getElementById("uuidnce_info").style.display = "block";
237
}
238
</script>
239
<pre id="uuidnce_info" style="display:none">Variant 0 UUID:
37 daniel-mar 240
- 32 bit High <abbr title="Count of 4&#xB5;s intervals passed since 1 Jan 1980 00:00:00 GMT">Time</abbr>
241
- 16 bit Low <abbr title="Count of 4&#xB5;s intervals passed since 1 Jan 1980 00:00:00 GMT">Time</abbr>
35 daniel-mar 242
- 16 bit Reserved
243
-  1 bit Variant (fix 0b0)
37 daniel-mar 244
-  7 bit <abbr title="socket_$unspec (0x0)
245
socket_$unix (0x1)
246
socket_$internet (0x2)
247
socket_$implink (0x3)
248
socket_$pup (0x4)
249
socket_$chaos (0x5)
250
socket_$ns (0x6)
251
socket_$nbs (0x7)
252
socket_$ecma (0x8)
253
socket_$datakit (0x9)
254
socket_$ccitt (0xA)
255
socket_$sna (0xB)
256
socket_$unspec2 (0xC)
257
socket_$dds (0xD)">Family</abbr>
35 daniel-mar 258
- 56 bit Node</pre></p>
259
 
31 daniel-mar 260
<h3 id="gen_uuidv2">Generate DCE Security (version 2) UUID</h3>
30 daniel-mar 261
 
37 daniel-mar 262
<p><i>An UUIDv2 contains information about the creator (person, group, or organization), the generating system (MAC address), and time.
35 daniel-mar 263
The creator information replaced parts of the time bits, therefore the time resolution is very low.</i></p>
264
 
265
<p><a id="uuidv2_info_button" href="javascript:show_uuidv2_info()">Show format</a>
266
<script>
267
function show_uuidv2_info() {
268
        document.getElementById("uuidv2_info_button").style.display = "none";
269
        document.getElementById("uuidv2_info").style.display = "block";
270
}
271
</script>
272
<pre id="uuidv2_info" style="display:none">Variant 1, Version 2 UUID:
273
- 32 bit Local Domain Number
37 daniel-mar 274
- 16 bit Mid <abbr title="Count of 429.4967296s intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
35 daniel-mar 275
-  4 bit Version (fix 0x2)
37 daniel-mar 276
- 12 bit High <abbr title="Count of 429.4967296s intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
35 daniel-mar 277
-  2 bit Variant (fix 0b10)
278
-  6 bit Clock Sequence
37 daniel-mar 279
-  8 bit <abbr title="0 = person
280
1 = group
281
2 = org
282
3-255 = site-defined">Local Domain</abbr>
35 daniel-mar 283
- 48 bit MAC Address</pre></p>
284
 
30 daniel-mar 285
<form method="GET" action="interprete_uuid.php">
2 daniel-mar 286
        <input type="hidden" name="version" value="2">
35 daniel-mar 287
        <label>Domain (8&nbsp;bits):</label><select name="domain_choose" id="dce_domain_choice" onchange="javascript:dce_domain_choose();">
34 daniel-mar 288
                <option value="uid">Person (e.g. POSIX UID)</option>
289
                <option value="gid">Group (e.g. POSIX GID)</option>
290
                <option value="org">Organization</option>
2 daniel-mar 291
                <option value="site">Site-defined</option>
35 daniel-mar 292
        </select> = <input type="number" min="0" max="255" name="dce_domain" value="" id="dce_domain" style="width:50px" pattern="[0-9]+"> (decimal notation)<br>
293
        <label>Value (32&nbsp;bits):</label><input type="number" min="0" max="4294967295" name="dce_id" value="0" id="dce_id" style="width:200px" pattern="[0-9]+"> (decimal notation)<br>
37 daniel-mar 294
        <font color="red">Warning</font>: The timestamp has an accuracy of 7:10 minutes,
30 daniel-mar 295
        therefore the uniqueness of these UUIDs is not guaranteed!<br><br>
59 daniel-mar 296
        <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Create UUIDv2">
2 daniel-mar 297
</form>
298
<script>
299
function dce_domain_choose() {
300
        var ns = document.getElementById('dce_domain_choice').value;
301
        if (ns == "uid") {
302
                document.getElementById('dce_domain').value = "0";
303
        }
304
        if (ns == "gid") {
305
                document.getElementById('dce_domain').value = "1";
306
        }
307
        if (ns == "org") {
308
                document.getElementById('dce_domain').value = "2";
309
        }
310
        if (ns == "site") {
311
                document.getElementById('dce_domain').value = "";
312
        }
313
}
314
dce_domain_choose();
315
</script>
316
 
61 daniel-mar 317
<h3 id="gen_uuidv35">Generate name-based (version 3 / 5 / <font color="green">New: 8</font>) UUID</h3>
2 daniel-mar 318
 
57 daniel-mar 319
<p><i>An UUIDv3 is made out of a MD5 hash and an UUIDv5 is made out of a SHA1 hash.
320
The revision of RFC4122 also contains an example for a custom UUIDv8 that
59 daniel-mar 321
allows SHA2, SHA3 and SHAKE hash algorithms. ViaThinkSoft added more hash
61 daniel-mar 322
algorithms and assigned Hash Space IDs to them.</i></p>
35 daniel-mar 323
 
324
<p><a id="uuidv35_info_button" href="javascript:show_uuidv35_info()">Show format</a>
325
<script>
326
function show_uuidv35_info() {
327
        document.getElementById("uuidv35_info_button").style.display = "none";
328
        document.getElementById("uuidv35_info").style.display = "block";
329
}
330
</script>
58 daniel-mar 331
<pre id="uuidv35_info" style="display:none">Variant 1, Version 3/5/8 UUID:
35 daniel-mar 332
- 48 bit Hash High
58 daniel-mar 333
-  4 bit Version (fix 0x3, 0x5, or 0x8)
35 daniel-mar 334
- 12 bit Hash Mid
335
-  2 bit Variant (fix 0b10)
336
- 62 bit Hash Low</pre></p>
337
 
338
<style>
339
label {
340
        width:120px;
341
        text-align:left;
342
        margin-right: 20px;
343
        display:inline-block;
344
}
345
</style>
346
 
2 daniel-mar 347
<form method="GET" action="interprete_uuid.php">
59 daniel-mar 348
        <label>Hash algorithm:</label><select name="version" id="nb_version" onchange="javascript:nb_version_choose();">
349
                <?php
61 daniel-mar 350
                $tmp = [];
351
                $tmp['MD5'] = '<option value="3">MD5 (UUIDv3)</option>';
352
                $tmp['SHA1'] = '<option value="5" selected>SHA1 (UUIDv5)</option>';
60 daniel-mar 353
                foreach (get_uuidv8_hash_space_ids() as list($algo,$space,$friendlyname,$author)) {
61 daniel-mar 354
                        $tmp[$friendlyname] = '<option value="8_namebased_'.$space.'">'.htmlentities($friendlyname).' (UUIDv8 defined by '.htmlentities($author).')</option>';
59 daniel-mar 355
                }
61 daniel-mar 356
                ksort($tmp);
357
                foreach ($tmp as $html) {
358
                        echo "\t\t$html\n";
359
                }
59 daniel-mar 360
                ?>
361
        </select><font size="-1"><span id="nb_hash_info"></span></font><br>
35 daniel-mar 362
        <label>Namespace:</label><select name="namespace_choose" id="nb_nsc" onchange="javascript:nb_ns_choose();">
2 daniel-mar 363
                <option value="dns">DNS</option>
364
                <option value="url">URL</option>
365
                <option value="oid">OID</option>
366
                <option value="x500">X.500 DN</option>
35 daniel-mar 367
                <!-- <option value="oidplus_ns">OIDplus ns only</option> -->
368
                <!-- <option value="oidplus_ns_val">OIDplus ns+val</option> -->
28 daniel-mar 369
                <!-- <option value="oidplus_pubkey">OIDplus pubkey</option> -->
2 daniel-mar 370
                <option value="other">Other</option>
59 daniel-mar 371
        </select> = Namespace UUID: <input type="text" name="nb_ns" value="" id="nb_ns" style="width:270px" onchange="javascript:nb_ns_textchange();" pattern="[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}"><br>
35 daniel-mar 372
        <label>Value:</label><input type="text" name="nb_val" value="" id="nb_val" style="width:300px"><br>
30 daniel-mar 373
        <font color="red">Warning</font>: These UUIDs do not contain a timestamp,
374
        therefore the uniqueness of these UUIDs is not guaranteed!<br><br>
59 daniel-mar 375
        <input type="hidden" name="uuid" value="CREATE"> <input type="submit" id="nb_create_btn" value="Create UUID">
2 daniel-mar 376
</form>
377
<script>
59 daniel-mar 378
function nb_version_choose() {
379
        var ver = document.getElementById('nb_version').value;
380
        document.getElementById('nb_create_btn').value = 'Create UUIDv' + ver.substr(0,1);
381
        var x = ver.split('_namebased_');
382
        if (x.length == 2) {
61 daniel-mar 383
                document.getElementById('nb_hash_info').innerHTML = ' (UUIDv8 Hash Space ID: ' + x[1] + ')';
59 daniel-mar 384
        } else {
385
                document.getElementById('nb_hash_info').innerHTML = '';
386
        }
387
 
388
}
35 daniel-mar 389
function nb_ns_textchange() {
390
        var ns = document.getElementById('nb_ns').value.toLowerCase();
391
        if (ns == "6ba7b810-9dad-11d1-80b4-00c04fd430c8") {
392
                if (document.getElementById('nb_nsc').value != "dns") {
393
                        document.getElementById('nb_nsc').value = "dns";
57 daniel-mar 394
                        document.getElementById('nb_val').value = "www.example.com";
35 daniel-mar 395
                }
396
        }
397
        else if (ns == "6ba7b811-9dad-11d1-80b4-00c04fd430c8") {
398
                if (document.getElementById('nb_nsc').value != "url") {
399
                        document.getElementById('nb_nsc').value = "url";
57 daniel-mar 400
                        document.getElementById('nb_val').value = "http://www.example.com/";
35 daniel-mar 401
                }
402
        }
403
        else if (ns == "6ba7b812-9dad-11d1-80b4-00c04fd430c8") {
404
                if (document.getElementById('nb_nsc').value != "oid") {
405
                        document.getElementById('nb_nsc').value = "oid";
406
                        document.getElementById('nb_val').value = "2.999";
407
                }
408
        }
409
        else if (ns == "6ba7b814-9dad-11d1-80b4-00c04fd430c8") {
410
                if (document.getElementById('nb_nsc').value != "x500") {
411
                        document.getElementById('nb_nsc').value = "x500";
412
                        document.getElementById('nb_val').value = "UID=jsmith,DC=example,DC=net";
413
                }
414
        }
415
        else {
416
                if (document.getElementById('nb_nsc').value != "other") {
417
                        document.getElementById('nb_nsc').value = "other";
418
                        document.getElementById('nb_val').value = "";
419
                }
420
        }
421
}
2 daniel-mar 422
function nb_ns_choose() {
423
        var ns = document.getElementById('nb_nsc').value;
424
        if (ns == "dns") {
425
                document.getElementById('nb_ns').value = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
57 daniel-mar 426
                document.getElementById('nb_val').value = "www.example.com";
2 daniel-mar 427
        }
35 daniel-mar 428
        else if (ns == "url") {
2 daniel-mar 429
                document.getElementById('nb_ns').value = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
57 daniel-mar 430
                document.getElementById('nb_val').value = "http://www.example.com/";
2 daniel-mar 431
        }
35 daniel-mar 432
        else if (ns == "oid") {
2 daniel-mar 433
                document.getElementById('nb_ns').value = "6ba7b812-9dad-11d1-80b4-00c04fd430c8";
434
                document.getElementById('nb_val').value = "2.999";
435
        }
35 daniel-mar 436
        else if (ns == "x500") {
2 daniel-mar 437
                document.getElementById('nb_ns').value = "6ba7b814-9dad-11d1-80b4-00c04fd430c8";
438
                document.getElementById('nb_val').value = "UID=jsmith,DC=example,DC=net";
439
        }
35 daniel-mar 440
        /*
441
        else if (ns == "oidplus_ns") {
2 daniel-mar 442
                document.getElementById('nb_ns').value = "0943e3ce-4b79-11e5-b742-78e3b5fc7f22";
443
                document.getElementById('nb_val').value = "ipv4";
444
        }
35 daniel-mar 445
        else if (ns == "oidplus_ns_val") {
2 daniel-mar 446
                document.getElementById('nb_ns').value = "ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22";
447
                document.getElementById('nb_val').value = "ipv4:8.8.8.8";
448
        }
35 daniel-mar 449
        else if (ns == "oidplus_ns_pubkey") {
28 daniel-mar 450
                document.getElementById('nb_ns').value = "fd16965c-8bab-11ed-8744-3c4a92df8582";
31 daniel-mar 451
                document.getElementById('nb_val').value = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqg/PnsC1WX3C1/mUSLuk0DIaDHtEsxBnG0auYJRJ1hBtbUUvItbK0odlKrX2SFo1MJJpu/SSxTzAgqkKZsZe3cCFkgA1svfuH9i94oGLjJ4n0kRJEGlanCmGndJBfIqGDJaQE2BJ8tLxeBrpkd9l0KvJsjhRmqJAb9KYK3KYFsWvT+wyjD3UJ1eHcgLbF/Qb3cwMU/u7Fs7ZpsNMW4phDPlsYsk9XHFpJ1/UCj6G53mYRfOC/ouDdGShlbVLB15s0V95QpnU/7lL8mJ2lE+sTZekGNBA4XbJv2gs21cR4E8zc/z+NyZS7117DYZoJqrAN8sKz6xGoKgQF6wueCK5qQIDAQAB";
28 daniel-mar 452
        }
453
        */
35 daniel-mar 454
        else if (ns == "other") {
2 daniel-mar 455
                document.getElementById('nb_ns').value = "";
456
                document.getElementById('nb_val').value = "";
457
        }
458
}
59 daniel-mar 459
nb_version_choose();
2 daniel-mar 460
nb_ns_choose();
461
</script>
462
 
61 daniel-mar 463
<h3 id="gen_uuidv8"><font color="green">New:</font> Generate Custom (version 8) UUID</h3>
34 daniel-mar 464
 
37 daniel-mar 465
<p><i>UUIDv8 is made of 122 bits application-specific / custom data. The other 6 bits are used to specify the variant and version of the UUID, to make it RFC-compatible.</i></p>
35 daniel-mar 466
 
467
<p><a id="uuidv8_info_button" href="javascript:show_uuidv8_info()">Show format</a>
468
<script>
469
function show_uuidv8_info() {
470
        document.getElementById("uuidv8_info_button").style.display = "none";
471
        document.getElementById("uuidv8_info").style.display = "block";
472
}
473
</script>
474
<pre id="uuidv8_info" style="display:none">Variant 1, Version 8 UUID:
475
- 48 bit Custom data
476
-  4 bit Version (fix 0x8)
477
- 12 bit Custom data
478
-  2 bit Variant (fix 0b10)
479
- 62 bit Custom data</pre></p>
480
 
34 daniel-mar 481
<form method="GET" action="interprete_uuid.php">
482
        <input type="hidden" name="version" value="8">
35 daniel-mar 483
        <label>Block&nbsp;1 (32&nbsp;bits):</label><input type="text" name="block1" value="00000000" maxlength="8"  id="v8_block1" style="width:150px" pattern="[0-9a-fA-F]+"> (hex notation)<br>
484
        <label>Block&nbsp;2 (16&nbsp;bits):</label><input type="text" name="block2" value="0000" maxlength="4"  id="v8_block2" style="width:150px" pattern="[0-9a-fA-F]+"> (hex notation)<br>
485
        <label>Block&nbsp;3 (<abbr title="The high 4 bits are occupied by the UUID version = 8">12&nbsp;bits</abbr>):</label><input type="text" name="block3" value="0000" maxlength="4"  id="v8_block3" style="width:150px" pattern="[0-9a-fA-F]+"> (hex notation)<br>
486
        <label>Block&nbsp;4 (<abbr title="The high 2 bits are occupied by the UUID variant = 0b10">14&nbsp;bits</abbr>):</label><input type="text" name="block4" value="0000" maxlength="4"  id="v8_block4" style="width:150px" pattern="[0-9a-fA-F]+"> (hex notation)<br>
487
        <label>Block&nbsp;5 (48&nbsp;bits):</label><input type="text" name="block5" value="000000000000" maxlength="12" id="v8_block5" style="width:150px" pattern="[0-9a-fA-F]+"> (hex notation)<br>
34 daniel-mar 488
        <font color="red">Warning</font>: These UUIDs do not contain a timestamp,
489
        therefore the uniqueness of these UUIDs is not guaranteed!<br><br>
59 daniel-mar 490
        <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Create UUIDv8">
34 daniel-mar 491
</form>
492
 
31 daniel-mar 493
<h2 id="interpret_uuid">Interpret a UUID</h2>
2 daniel-mar 494
 
30 daniel-mar 495
<p>You can enter a UUID in the following notations:</p>
2 daniel-mar 496
 
497
<ul>
498
        <li>Classic notation (case insensitive, curly braces optional): <code>9e83839a-5967-11e4-8c1c-78e3b5fc7f22</code></li>
499
        <li>As OID: <code>2.25.210700883446948645633376489934419689250</code></li>
500
</ul>
501
 
502
<p>The script will output:</p>
503
 
504
<ul>
505
        <li>Notation as UUID and OID</li>
35 daniel-mar 506
        <li>Version, variant, and additional data (date and time, clock sequence, node id, etc.)</li>
2 daniel-mar 507
</ul>
508
 
30 daniel-mar 509
<p>Please enter a UUID or UUID OID:</p>
2 daniel-mar 510
 
511
<form method="GET" action="interprete_uuid.php">
32 daniel-mar 512
        <input type="text" name="uuid" value="" style="width:300px"> <input type="submit" value="Interprete">
2 daniel-mar 513
</form>
514
 
31 daniel-mar 515
<h2 id="interpret_mac">Interpret a MAC address (<abbr title="Media Access Control">MAC</abbr> /
26 daniel-mar 516
<abbr title="Extended Unique Identifier">EUI</abbr> /
517
<abbr title="Extended Local Identifier">ELI</abbr> /
518
<abbr title="Standard Assigned Identifier">SAI</abbr> /
519
<abbr title="Administratively Assigned Identifier">AAI</abbr>)</h2>
2 daniel-mar 520
 
30 daniel-mar 521
<p>You can enter a UUID in the following notations:</p>
2 daniel-mar 522
 
523
<ul>
524
        <li><code>AA-BB-CC-DD-EE-FF</code></li>
525
        <li><code>AA:BB:CC:DD:EE:FF</code></li>
526
        <li><code>AABBCC.DDEEFF</code> (case insensitive)</li>
16 daniel-mar 527
        <li><code>AA-BB-CC-DD-EE-FF-11-22</code> (EUI-64)</li>
528
        <li><code>AA:BB:CC:DD:EE:FF-11-22</code> (EUI-64)</li>
529
        <li><code>fe80::1322:33ff:fe44:5566</code> (IPv6 Link Local / EUI-64)</li>
2 daniel-mar 530
</ul>
531
 
532
<p>The script will output:</p>
533
 
534
<ul>
535
        <li>Information about the I/G and U/L flags.</li>
536
        <li>Information about the entry in the IEEE registry, if available.</li>
537
        <li>Information about the registrant, if available.</li>
538
</ul>
539
 
29 daniel-mar 540
<p>Please enter a MAC (EUI, ELI, SAI, AAI), or IPv6-Link-Local address:</p>
2 daniel-mar 541
 
542
<form method="GET" action="interprete_mac.php">
32 daniel-mar 543
        <input type="text" name="mac" value="" style="width:250px"> <input type="submit" value="Interprete">
2 daniel-mar 544
</form>
545
 
41 daniel-mar 546
<h3 id="gen_aai">Generate an AAI</h3>
547
 
548
<p><i>An Administratively Assigned Identifier (AAI) is a MAC address which can be locally defined
549
by applications or an administrator. Unlike the EUI, an AAI is NOT worldwide unique.</i></p>
550
 
551
<form method="GET" action="interprete_mac.php">
552
    <input type="hidden" name="aai_gen" value="1">
553
    <input type="hidden" name="aai_gen_bits" value="48">
554
    <input type="hidden" name="aai_gen_multicast" value="0">
555
    <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Generate AAI-48">
556
</form>
557
 
558
<br>
559
 
560
<form method="GET" action="interprete_mac.php">
561
    <input type="hidden" name="aai_gen" value="1">
562
    <input type="hidden" name="aai_gen_bits" value="64">
563
    <input type="hidden" name="aai_gen_multicast" value="0">
564
    <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Generate AAI-64">
565
</form>
566
 
567
<p>The following options are rather unusual, but are implemented for the sake of completeness:</p>
568
 
569
<form method="GET" action="interprete_mac.php">
570
    <input type="hidden" name="aai_gen" value="1">
571
    <input type="hidden" name="aai_gen_bits" value="48">
572
    <input type="hidden" name="aai_gen_multicast" value="1">
573
    <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Generate Multicast AAI-48">
574
</form>
575
 
576
<br>
577
 
578
<form method="GET" action="interprete_mac.php">
579
    <input type="hidden" name="aai_gen" value="1">
580
    <input type="hidden" name="aai_gen_bits" value="64">
581
    <input type="hidden" name="aai_gen_multicast" value="1">
582
    <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Generate Multicast AAI-64">
583
</form>
584
 
585
 
22 daniel-mar 586
<br><br><br>
587
 
2 daniel-mar 588
</body>
589
 
590
</html>