Subversion Repositories uuid_mac_utils

Rev

Rev 53 | Rev 58 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 53 Rev 57
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
* UUID & MAC Utils
4
* UUID & MAC Utils
5
* Copyright 2017 - 2023 Daniel Marschall, ViaThinkSoft
5
* Copyright 2017 - 2023 Daniel Marschall, ViaThinkSoft
6
* Version 2023-07-12
6
* Version 2023-08-02
7
*
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with 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
10
* You may obtain a copy of the License at
11
*
11
*
Line 48... Line 48...
48
            <li><a href="#gen_uuidv1">Generate time-based (version 1) UUID</a></li>
48
            <li><a href="#gen_uuidv1">Generate time-based (version 1) UUID</a></li>
49
        </ul></li>
49
        </ul></li>
50
    <li><a href="#gen_other_uuid">Generate other UUID types</a><ul>
50
    <li><a href="#gen_other_uuid">Generate other UUID types</a><ul>
51
            <li><a href="#gen_uuid_ncs">NCS (variant 0) UUID</a></li>
51
            <li><a href="#gen_uuid_ncs">NCS (variant 0) UUID</a></li>
52
            <li><a href="#gen_uuidv2">Generate DCE Security (version 2) UUID</a></li>
52
            <li><a href="#gen_uuidv2">Generate DCE Security (version 2) UUID</a></li>
53
            <li><a href="#gen_uuidv35">Generate name-based (version 3/5) UUID</a></li>
53
            <li><a href="#gen_uuidv35">Generate name-based (version 3/5/8) UUID</a></li>
54
            <li><a href="#gen_uuidv8">Generate Custom (version 8) UUID</a></li>
54
            <li><a href="#gen_uuidv8">Generate Custom (version 8) UUID</a></li>
55
        </ul></li>
55
        </ul></li>
56
    <li><a href="#interpret_uuid">Interpret a UUID</a></li>
56
    <li><a href="#interpret_uuid">Interpret a UUID</a></li>
57
    <li><a href="#interpret_mac">Interpret a MAC address (MAC / EUI / ELI / SAI / AAI)</a><ul>
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>
58
        <li><a href="#gen_aai">Generate an AAI</a></li>
Line 312... Line 312...
312
        }
312
        }
313
}
313
}
314
dce_domain_choose();
314
dce_domain_choose();
315
</script>
315
</script>
316
 
316
 
317
<h3 id="gen_uuidv35">Generate name-based (version 3/5) UUID</h3>
317
<h3 id="gen_uuidv35">Generate name-based (version 3/5/8) UUID</h3>
318
 
318
 
319
<p><i>An UUIDv3 is made out of a MD5 hash and an UUIDv5 is made out of a SHA1 hash.</i></p>
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
-
 
321
allows SHA2 and SHA3 hash algorithms.</i></p>
320
 
322
 
321
<p><a id="uuidv35_info_button" href="javascript:show_uuidv35_info()">Show format</a>
323
<p><a id="uuidv35_info_button" href="javascript:show_uuidv35_info()">Show format</a>
322
<script>
324
<script>
323
function show_uuidv35_info() {
325
function show_uuidv35_info() {
324
        document.getElementById("uuidv35_info_button").style.display = "none";
326
        document.getElementById("uuidv35_info_button").style.display = "none";
Line 343... Line 345...
343
 
345
 
344
<form method="GET" action="interprete_uuid.php">
346
<form method="GET" action="interprete_uuid.php">
345
        <label>Hash algorithm:</label><select name="version">
347
        <label>Hash algorithm:</label><select name="version">
346
                <option value="3">MD5 (version 3 UUID)</option>
348
                <option value="3">MD5 (version 3 UUID)</option>
347
                <option value="5">SHA1 (version 5 UUID)</option>
349
                <option value="5">SHA1 (version 5 UUID)</option>
-
 
350
                <option value="8_namebased_59031ca3-fbdb-47fb-9f6c-0f30e2e83145">SHA2-224 (version 8 UUID Example)</option>
-
 
351
                <option value="8_namebased_3fb32780-953c-4464-9cfd-e85dbbe9843d">SHA2-256 (version 8 UUID Example)</option>
-
 
352
                <option value="8_namebased_e6800581-f333-484b-8778-601ff2b58da8">SHA2-384 (version 8 UUID Example)</option>
-
 
353
                <option value="8_namebased_0fde22f2-e7ba-4fd1-9753-9c2ea88fa3f9">SHA2-512 (version 8 UUID Example)</option>
-
 
354
                <option value="8_namebased_003c2038-c4fe-4b95-a672-0c26c1b79542">SHA2-512/224 (version 8 UUID Example)</option>
-
 
355
                <option value="8_namebased_9475ad00-3769-4c07-9642-5e7383732306">SHA2-512/256 (version 8 UUID Example)</option>
-
 
356
                <option value="8_namebased_9768761f-ac5a-419e-a180-7ca239e8025a">SHA3-224 (version 8 UUID Example)</option>
-
 
357
                <option value="8_namebased_2034d66b-4047-4553-8f80-70e593176877">SHA3-256 (version 8 UUID Example)</option>
-
 
358
                <option value="8_namebased_872fb339-2636-4bdd-bda6-b6dc2a82b1b3">SHA3-384 (version 8 UUID Example)</option>
-
 
359
                <option value="8_namebased_a4920a5d-a8a6-426c-8d14-a6cafbe64c7b">SHA3-512 (version 8 UUID Example)</option>
-
 
360
                <option value="8_namebased_7ea218f6-629a-425f-9f88-7439d63296bb">SHAKE-128 (version 8 UUID Example)</option>
-
 
361
                <option value="8_namebased_2e7fc6a4-2919-4edc-b0ba-7d7062ce4f0a">SHAKE-256 (version 8 UUID Example)</option>
348
        </select><br>
362
        </select><br>
349
        <label>Namespace:</label><select name="namespace_choose" id="nb_nsc" onchange="javascript:nb_ns_choose();">
363
        <label>Namespace:</label><select name="namespace_choose" id="nb_nsc" onchange="javascript:nb_ns_choose();">
350
                <option value="dns">DNS</option>
364
                <option value="dns">DNS</option>
351
                <option value="url">URL</option>
365
                <option value="url">URL</option>
352
                <option value="oid">OID</option>
366
                <option value="oid">OID</option>
Line 365... Line 379...
365
function nb_ns_textchange() {
379
function nb_ns_textchange() {
366
        var ns = document.getElementById('nb_ns').value.toLowerCase();
380
        var ns = document.getElementById('nb_ns').value.toLowerCase();
367
        if (ns == "6ba7b810-9dad-11d1-80b4-00c04fd430c8") {
381
        if (ns == "6ba7b810-9dad-11d1-80b4-00c04fd430c8") {
368
                if (document.getElementById('nb_nsc').value != "dns") {
382
                if (document.getElementById('nb_nsc').value != "dns") {
369
                        document.getElementById('nb_nsc').value = "dns";
383
                        document.getElementById('nb_nsc').value = "dns";
370
                        document.getElementById('nb_val').value = "www.example.org";
384
                        document.getElementById('nb_val').value = "www.example.com";
371
                }
385
                }
372
        }
386
        }
373
        else if (ns == "6ba7b811-9dad-11d1-80b4-00c04fd430c8") {
387
        else if (ns == "6ba7b811-9dad-11d1-80b4-00c04fd430c8") {
374
                if (document.getElementById('nb_nsc').value != "url") {
388
                if (document.getElementById('nb_nsc').value != "url") {
375
                        document.getElementById('nb_nsc').value = "url";
389
                        document.getElementById('nb_nsc').value = "url";
376
                        document.getElementById('nb_val').value = "http://www.example.org/";
390
                        document.getElementById('nb_val').value = "http://www.example.com/";
377
                }
391
                }
378
        }
392
        }
379
        else if (ns == "6ba7b812-9dad-11d1-80b4-00c04fd430c8") {
393
        else if (ns == "6ba7b812-9dad-11d1-80b4-00c04fd430c8") {
380
                if (document.getElementById('nb_nsc').value != "oid") {
394
                if (document.getElementById('nb_nsc').value != "oid") {
381
                        document.getElementById('nb_nsc').value = "oid";
395
                        document.getElementById('nb_nsc').value = "oid";
Line 397... Line 411...
397
}
411
}
398
function nb_ns_choose() {
412
function nb_ns_choose() {
399
        var ns = document.getElementById('nb_nsc').value;
413
        var ns = document.getElementById('nb_nsc').value;
400
        if (ns == "dns") {
414
        if (ns == "dns") {
401
                document.getElementById('nb_ns').value = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
415
                document.getElementById('nb_ns').value = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
402
                document.getElementById('nb_val').value = "www.example.org";
416
                document.getElementById('nb_val').value = "www.example.com";
403
        }
417
        }
404
        else if (ns == "url") {
418
        else if (ns == "url") {
405
                document.getElementById('nb_ns').value = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
419
                document.getElementById('nb_ns').value = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
406
                document.getElementById('nb_val').value = "http://www.example.org/";
420
                document.getElementById('nb_val').value = "http://www.example.com/";
407
        }
421
        }
408
        else if (ns == "oid") {
422
        else if (ns == "oid") {
409
                document.getElementById('nb_ns').value = "6ba7b812-9dad-11d1-80b4-00c04fd430c8";
423
                document.getElementById('nb_ns').value = "6ba7b812-9dad-11d1-80b4-00c04fd430c8";
410
                document.getElementById('nb_val').value = "2.999";
424
                document.getElementById('nb_val').value = "2.999";
411
        }
425
        }