Subversion Repositories uuid_mac_utils

Rev

Rev 53 | Rev 58 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. /*
  4. * UUID & MAC Utils
  5. * Copyright 2017 - 2023 Daniel Marschall, ViaThinkSoft
  6. * Version 2023-08-02
  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.  
  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>
  32.         <meta name=viewport content="width=device-width, initial-scale=1">
  33. </head>
  34.  
  35. <body>
  36.  
  37. <h1>UUID &amp; MAC Utils by Daniel Marschall</h1>
  38.  
  39. <p><a href="https://github.com/danielmarschall/uuid_mac_utils/">View the source code</a></p>
  40.  
  41. <h2>Overview</h2>
  42.  
  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>
  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>
  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>
  55.         </ul></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>
  58.         <li><a href="#gen_aai">Generate an AAI</a></li>
  59.     </ul></li>
  60. </ul>
  61.  
  62. <h2 id="gen_uuid">Generate random and/or time-based UUIDs</h2>
  63.  
  64. <h3 id="gen_uuidv7"><font color="green">New:</font> Generate Unix Epoch Time (version 7) UUID &#11088</h3>
  65.  
  66. <p><i>A UUIDv7 is made of time and 74 random&nbsp;bits.
  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.  
  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:
  79. - 48 bit <abbr title="Count of 1ms intervals passed since 1 Jan 1970 00:00:00 GMT">Unix Time in milliseconds</abbr>
  80. -  4 bit Version (fix 0x7)
  81. - 12 bit Random
  82. -  2 bit Variant (fix 0b10)
  83. - 62 bit Random</pre></p>
  84.  
  85. <?php
  86. if (AUTO_NEW_UUIDS > 0) { /** @phpstan-ignore-line */
  87.         echo '<p>Here are '.AUTO_NEW_UUIDS.' UUIDs that were created just for you! (Reload the page to get more)</p>';
  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.  
  98. <form method="GET" action="interprete_uuid.php">
  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">
  101. </form>
  102.  
  103. <h3 id="gen_uuidv6"><font color="green">New:</font> Generate reordered time-based (version 6) UUID &#9200;</h3>
  104.  
  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>
  108.  
  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:
  117. - 48 bit High <abbr title="Count of 100ns intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
  118. -  4 bit Version (fix 0x6)
  119. - 12 bit Low <abbr title="Count of 100ns intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
  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.  
  125. <?php
  126. if (AUTO_NEW_UUIDS > 0) { /** @phpstan-ignore-line */
  127.         echo '<p>Here are '.AUTO_NEW_UUIDS.' UUIDs that were created just for you! (Reload the page to get more)</p>';
  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.  
  138. <form method="GET" action="interprete_uuid.php">
  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">
  141. </form>
  142.  
  143. <h3 id="gen_uuidv4">Generate random (version 4) UUID &#x1F3B2;</h3>
  144.  
  145. <p><i>A UUIDv4 is made of 122 random&nbsp;bits. No other information is encoded in this kind of UUID.</i></p>
  146.  
  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.  
  161. <?php
  162. if (AUTO_NEW_UUIDS > 0) { /** @phpstan-ignore-line */
  163.         echo '<p>Here are '.AUTO_NEW_UUIDS.' UUIDs that were created just for you! (Reload the page to get more)</p>';
  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.  
  174. <form method="GET" action="interprete_uuid.php">
  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">
  177. </form>
  178.  
  179. <h3 id="gen_uuidv1">Generate time-based (version 1) UUID &#9200;</h3>
  180.  
  181. <p><i>A UUIDv1 is made of the MAC address of the generating computer,
  182. the time, and a clock sequence.</i></p>
  183.  
  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:
  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>
  194. -  4 bit Version (fix 0x1)
  195. - 12 bit High <abbr title="Count of 100ns intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
  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.  
  201. <?php
  202. if (AUTO_NEW_UUIDS > 0) { /** @phpstan-ignore-line */
  203.     echo '<p>Here are '.AUTO_NEW_UUIDS.' UUIDs that were created just for you! (Reload the page to get more)</p>';
  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.  
  214. <form method="GET" action="interprete_uuid.php">
  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">
  217. </form>
  218.  
  219. <h2 id="gen_other_uuid">Generate other UUID types</h2>
  220.  
  221. <p><i>The following types of UUIDs are less common and/or require special knowledge. Please only use the following
  222. generators if you know what you are doing.</i></p>
  223.  
  224. <h3 id="gen_uuid_ncs">NCS (variant 0) UUID</h3>
  225.  
  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
  228. amount of available timestamp bits was exhausted on <strong>5 September 2015</strong>.
  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:
  230. <a href="interprete_uuid.php?uuid=ffffffff-ffff-0000-027f-000001000000"><code>ffffffff-ffff-0000-027f-000001000000</code></a>.</p>
  231.  
  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:
  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>
  242. - 16 bit Reserved
  243. -  1 bit Variant (fix 0b0)
  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>
  258. - 56 bit Node</pre></p>
  259.  
  260. <h3 id="gen_uuidv2">Generate DCE Security (version 2) UUID</h3>
  261.  
  262. <p><i>An UUIDv2 contains information about the creator (person, group, or organization), the generating system (MAC address), and time.
  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
  274. - 16 bit Mid <abbr title="Count of 429.4967296s intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
  275. -  4 bit Version (fix 0x2)
  276. - 12 bit High <abbr title="Count of 429.4967296s intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr>
  277. -  2 bit Variant (fix 0b10)
  278. -  6 bit Clock Sequence
  279. -  8 bit <abbr title="0 = person
  280. 1 = group
  281. 2 = org
  282. 3-255 = site-defined">Local Domain</abbr>
  283. - 48 bit MAC Address</pre></p>
  284.  
  285. <form method="GET" action="interprete_uuid.php">
  286.         <input type="hidden" name="version" value="2">
  287.         <label>Domain (8&nbsp;bits):</label><select name="domain_choose" id="dce_domain_choice" onchange="javascript:dce_domain_choose();">
  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>
  291.                 <option value="site">Site-defined</option>
  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>
  294.         <font color="red">Warning</font>: The timestamp has an accuracy of 7:10 minutes,
  295.         therefore the uniqueness of these UUIDs is not guaranteed!<br><br>
  296.         <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Create UUID">
  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.  
  317. <h3 id="gen_uuidv35">Generate name-based (version 3/5/8) UUID</h3>
  318.  
  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>
  322.  
  323. <p><a id="uuidv35_info_button" href="javascript:show_uuidv35_info()">Show format</a>
  324. <script>
  325. function show_uuidv35_info() {
  326.         document.getElementById("uuidv35_info_button").style.display = "none";
  327.         document.getElementById("uuidv35_info").style.display = "block";
  328. }
  329. </script>
  330. <pre id="uuidv35_info" style="display:none">Variant 1, Version 3/5 UUID:
  331. - 48 bit Hash High
  332. -  4 bit Version (fix 0x3)
  333. - 12 bit Hash Mid
  334. -  2 bit Variant (fix 0b10)
  335. - 62 bit Hash Low</pre></p>
  336.  
  337. <style>
  338. label {
  339.         width:120px;
  340.         text-align:left;
  341.         margin-right: 20px;
  342.         display:inline-block;
  343. }
  344. </style>
  345.  
  346. <form method="GET" action="interprete_uuid.php">
  347.         <label>Hash algorithm:</label><select name="version">
  348.                 <option value="3">MD5 (version 3 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>
  362.         </select><br>
  363.         <label>Namespace:</label><select name="namespace_choose" id="nb_nsc" onchange="javascript:nb_ns_choose();">
  364.                 <option value="dns">DNS</option>
  365.                 <option value="url">URL</option>
  366.                 <option value="oid">OID</option>
  367.                 <option value="x500">X.500 DN</option>
  368.                 <!-- <option value="oidplus_ns">OIDplus ns only</option> -->
  369.                 <!-- <option value="oidplus_ns_val">OIDplus ns+val</option> -->
  370.                 <!-- <option value="oidplus_pubkey">OIDplus pubkey</option> -->
  371.                 <option value="other">Other</option>
  372.         </select> = <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>
  373.         <label>Value:</label><input type="text" name="nb_val" value="" id="nb_val" style="width:300px"><br>
  374.         <font color="red">Warning</font>: These UUIDs do not contain a timestamp,
  375.         therefore the uniqueness of these UUIDs is not guaranteed!<br><br>
  376.         <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Create UUID">
  377. </form>
  378. <script>
  379. function nb_ns_textchange() {
  380.         var ns = document.getElementById('nb_ns').value.toLowerCase();
  381.         if (ns == "6ba7b810-9dad-11d1-80b4-00c04fd430c8") {
  382.                 if (document.getElementById('nb_nsc').value != "dns") {
  383.                         document.getElementById('nb_nsc').value = "dns";
  384.                         document.getElementById('nb_val').value = "www.example.com";
  385.                 }
  386.         }
  387.         else if (ns == "6ba7b811-9dad-11d1-80b4-00c04fd430c8") {
  388.                 if (document.getElementById('nb_nsc').value != "url") {
  389.                         document.getElementById('nb_nsc').value = "url";
  390.                         document.getElementById('nb_val').value = "http://www.example.com/";
  391.                 }
  392.         }
  393.         else if (ns == "6ba7b812-9dad-11d1-80b4-00c04fd430c8") {
  394.                 if (document.getElementById('nb_nsc').value != "oid") {
  395.                         document.getElementById('nb_nsc').value = "oid";
  396.                         document.getElementById('nb_val').value = "2.999";
  397.                 }
  398.         }
  399.         else if (ns == "6ba7b814-9dad-11d1-80b4-00c04fd430c8") {
  400.                 if (document.getElementById('nb_nsc').value != "x500") {
  401.                         document.getElementById('nb_nsc').value = "x500";
  402.                         document.getElementById('nb_val').value = "UID=jsmith,DC=example,DC=net";
  403.                 }
  404.         }
  405.         else {
  406.                 if (document.getElementById('nb_nsc').value != "other") {
  407.                         document.getElementById('nb_nsc').value = "other";
  408.                         document.getElementById('nb_val').value = "";
  409.                 }
  410.         }
  411. }
  412. function nb_ns_choose() {
  413.         var ns = document.getElementById('nb_nsc').value;
  414.         if (ns == "dns") {
  415.                 document.getElementById('nb_ns').value = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
  416.                 document.getElementById('nb_val').value = "www.example.com";
  417.         }
  418.         else if (ns == "url") {
  419.                 document.getElementById('nb_ns').value = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
  420.                 document.getElementById('nb_val').value = "http://www.example.com/";
  421.         }
  422.         else if (ns == "oid") {
  423.                 document.getElementById('nb_ns').value = "6ba7b812-9dad-11d1-80b4-00c04fd430c8";
  424.                 document.getElementById('nb_val').value = "2.999";
  425.         }
  426.         else if (ns == "x500") {
  427.                 document.getElementById('nb_ns').value = "6ba7b814-9dad-11d1-80b4-00c04fd430c8";
  428.                 document.getElementById('nb_val').value = "UID=jsmith,DC=example,DC=net";
  429.         }
  430.         /*
  431.         else if (ns == "oidplus_ns") {
  432.                 document.getElementById('nb_ns').value = "0943e3ce-4b79-11e5-b742-78e3b5fc7f22";
  433.                 document.getElementById('nb_val').value = "ipv4";
  434.         }
  435.         else if (ns == "oidplus_ns_val") {
  436.                 document.getElementById('nb_ns').value = "ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22";
  437.                 document.getElementById('nb_val').value = "ipv4:8.8.8.8";
  438.         }
  439.         else if (ns == "oidplus_ns_pubkey") {
  440.                 document.getElementById('nb_ns').value = "fd16965c-8bab-11ed-8744-3c4a92df8582";
  441.                 document.getElementById('nb_val').value = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqg/PnsC1WX3C1/mUSLuk0DIaDHtEsxBnG0auYJRJ1hBtbUUvItbK0odlKrX2SFo1MJJpu/SSxTzAgqkKZsZe3cCFkgA1svfuH9i94oGLjJ4n0kRJEGlanCmGndJBfIqGDJaQE2BJ8tLxeBrpkd9l0KvJsjhRmqJAb9KYK3KYFsWvT+wyjD3UJ1eHcgLbF/Qb3cwMU/u7Fs7ZpsNMW4phDPlsYsk9XHFpJ1/UCj6G53mYRfOC/ouDdGShlbVLB15s0V95QpnU/7lL8mJ2lE+sTZekGNBA4XbJv2gs21cR4E8zc/z+NyZS7117DYZoJqrAN8sKz6xGoKgQF6wueCK5qQIDAQAB";
  442.         }
  443.         */
  444.         else if (ns == "other") {
  445.                 document.getElementById('nb_ns').value = "";
  446.                 document.getElementById('nb_val').value = "";
  447.         }
  448. }
  449. nb_ns_choose();
  450. </script>
  451.  
  452. <h3 id="gen_uuidv8">Generate Custom (version 8) UUID</h3>
  453.  
  454. <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>
  455.  
  456. <p><a id="uuidv8_info_button" href="javascript:show_uuidv8_info()">Show format</a>
  457. <script>
  458. function show_uuidv8_info() {
  459.         document.getElementById("uuidv8_info_button").style.display = "none";
  460.         document.getElementById("uuidv8_info").style.display = "block";
  461. }
  462. </script>
  463. <pre id="uuidv8_info" style="display:none">Variant 1, Version 8 UUID:
  464. - 48 bit Custom data
  465. -  4 bit Version (fix 0x8)
  466. - 12 bit Custom data
  467. -  2 bit Variant (fix 0b10)
  468. - 62 bit Custom data</pre></p>
  469.  
  470. <form method="GET" action="interprete_uuid.php">
  471.         <input type="hidden" name="version" value="8">
  472.         <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>
  473.         <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>
  474.         <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>
  475.         <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>
  476.         <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>
  477.         <font color="red">Warning</font>: These UUIDs do not contain a timestamp,
  478.         therefore the uniqueness of these UUIDs is not guaranteed!<br><br>
  479.         <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Create UUID">
  480. </form>
  481.  
  482. <h2 id="interpret_uuid">Interpret a UUID</h2>
  483.  
  484. <p>You can enter a UUID in the following notations:</p>
  485.  
  486. <ul>
  487.         <li>Classic notation (case insensitive, curly braces optional): <code>9e83839a-5967-11e4-8c1c-78e3b5fc7f22</code></li>
  488.         <li>As OID: <code>2.25.210700883446948645633376489934419689250</code></li>
  489. </ul>
  490.  
  491. <p>The script will output:</p>
  492.  
  493. <ul>
  494.         <li>Notation as UUID and OID</li>
  495.         <li>Version, variant, and additional data (date and time, clock sequence, node id, etc.)</li>
  496. </ul>
  497.  
  498. <p>Please enter a UUID or UUID OID:</p>
  499.  
  500. <form method="GET" action="interprete_uuid.php">
  501.         <input type="text" name="uuid" value="" style="width:300px"> <input type="submit" value="Interprete">
  502. </form>
  503.  
  504. <h2 id="interpret_mac">Interpret a MAC address (<abbr title="Media Access Control">MAC</abbr> /
  505. <abbr title="Extended Unique Identifier">EUI</abbr> /
  506. <abbr title="Extended Local Identifier">ELI</abbr> /
  507. <abbr title="Standard Assigned Identifier">SAI</abbr> /
  508. <abbr title="Administratively Assigned Identifier">AAI</abbr>)</h2>
  509.  
  510. <p>You can enter a UUID in the following notations:</p>
  511.  
  512. <ul>
  513.         <li><code>AA-BB-CC-DD-EE-FF</code></li>
  514.         <li><code>AA:BB:CC:DD:EE:FF</code></li>
  515.         <li><code>AABBCC.DDEEFF</code> (case insensitive)</li>
  516.         <li><code>AA-BB-CC-DD-EE-FF-11-22</code> (EUI-64)</li>
  517.         <li><code>AA:BB:CC:DD:EE:FF-11-22</code> (EUI-64)</li>
  518.         <li><code>fe80::1322:33ff:fe44:5566</code> (IPv6 Link Local / EUI-64)</li>
  519. </ul>
  520.  
  521. <p>The script will output:</p>
  522.  
  523. <ul>
  524.         <li>Information about the I/G and U/L flags.</li>
  525.         <li>Information about the entry in the IEEE registry, if available.</li>
  526.         <li>Information about the registrant, if available.</li>
  527. </ul>
  528.  
  529. <p>Please enter a MAC (EUI, ELI, SAI, AAI), or IPv6-Link-Local address:</p>
  530.  
  531. <form method="GET" action="interprete_mac.php">
  532.         <input type="text" name="mac" value="" style="width:250px"> <input type="submit" value="Interprete">
  533. </form>
  534.  
  535. <h3 id="gen_aai">Generate an AAI</h3>
  536.  
  537. <p><i>An Administratively Assigned Identifier (AAI) is a MAC address which can be locally defined
  538. by applications or an administrator. Unlike the EUI, an AAI is NOT worldwide unique.</i></p>
  539.  
  540. <form method="GET" action="interprete_mac.php">
  541.     <input type="hidden" name="aai_gen" value="1">
  542.     <input type="hidden" name="aai_gen_bits" value="48">
  543.     <input type="hidden" name="aai_gen_multicast" value="0">
  544.     <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Generate AAI-48">
  545. </form>
  546.  
  547. <br>
  548.  
  549. <form method="GET" action="interprete_mac.php">
  550.     <input type="hidden" name="aai_gen" value="1">
  551.     <input type="hidden" name="aai_gen_bits" value="64">
  552.     <input type="hidden" name="aai_gen_multicast" value="0">
  553.     <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Generate AAI-64">
  554. </form>
  555.  
  556. <p>The following options are rather unusual, but are implemented for the sake of completeness:</p>
  557.  
  558. <form method="GET" action="interprete_mac.php">
  559.     <input type="hidden" name="aai_gen" value="1">
  560.     <input type="hidden" name="aai_gen_bits" value="48">
  561.     <input type="hidden" name="aai_gen_multicast" value="1">
  562.     <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Generate Multicast AAI-48">
  563. </form>
  564.  
  565. <br>
  566.  
  567. <form method="GET" action="interprete_mac.php">
  568.     <input type="hidden" name="aai_gen" value="1">
  569.     <input type="hidden" name="aai_gen_bits" value="64">
  570.     <input type="hidden" name="aai_gen_multicast" value="1">
  571.     <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Generate Multicast AAI-64">
  572. </form>
  573.  
  574.  
  575. <br><br><br>
  576.  
  577. </body>
  578.  
  579. </html>
  580.