Rev 61 | Rev 63 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 61 | Rev 62 | ||
---|---|---|---|
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-08-02 |
6 | * Version 2023-08-03 |
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 59... | Line 59... | ||
59 | </ul></li> |
59 | </ul></li> |
60 | </ul> |
60 | </ul> |
61 | 61 | ||
62 | <h2 id="gen_uuid">Generate random and/or time-based UUIDs</h2> |
62 | <h2 id="gen_uuid">Generate random and/or time-based UUIDs</h2> |
63 | 63 | ||
64 | <h3 id="gen_uuidv7"><font color="green">New:</font> Generate Unix Epoch Time (version 7) UUID ⭐</h3> |
64 | <h3 id="gen_uuidv7"><font color="green">New:</font> Generate Unix Epoch Time (version 7) UUID ⭐</h3> |
65 | 65 | ||
66 | <p><i>A UUIDv7 is made of time and 74 random bits. |
66 | <p><i>A UUIDv7 is made of time and 74 random bits. |
67 | Since the time is at the beginning, the UUIDs are monotonically increasing. |
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 |
68 | Due to the missing MAC address, this UUID version is recommended due to |
69 | improved privacy.</i></p> |
69 | improved privacy.</i></p> |
70 | 70 | ||
71 | <p><a id="uuidv7_info_button" href="javascript:show_uuidv7_info()">Show format</a> |
- | |
72 | <script> |
71 | <script> |
73 | function show_uuidv7_info() { |
72 | function show_uuidv7_info() { |
74 | document.getElementById("uuidv7_info_button").style.display = "none"; |
73 | document.getElementById("uuidv7_info_button").style.display = "none"; |
75 | document.getElementById("uuidv7_info").style.display = "block"; |
74 | document.getElementById("uuidv7_info").style.display = "block"; |
76 | } |
75 | } |
77 | </script> |
76 | </script> |
- | 77 | <p><a id="uuidv7_info_button" href="javascript:show_uuidv7_info()">Show format</a> |
|
78 | <pre id="uuidv7_info" style="display:none">Variant 1, Version 7 UUID: |
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> |
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) |
80 | - 4 bit Version (fix 0x7) |
81 | - 12 bit Random |
81 | - 12 bit Random |
82 | - 2 bit Variant (fix 0b10) |
82 | - 2 bit Variant (fix 0b10) |
Line 104... | Line 104... | ||
104 | 104 | ||
105 | <p><i>Like UUIDv1, this kind of UUID is made of the MAC address of the generating computer, |
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), |
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> |
107 | so that UUIDs are monotonically increasing.</i></p> |
108 | 108 | ||
109 | <p><a id="uuidv6_info_button" href="javascript:show_uuidv6_info()">Show format</a> |
- | |
110 | <script> |
109 | <script> |
111 | function show_uuidv6_info() { |
110 | function show_uuidv6_info() { |
112 | document.getElementById("uuidv6_info_button").style.display = "none"; |
111 | document.getElementById("uuidv6_info_button").style.display = "none"; |
113 | document.getElementById("uuidv6_info").style.display = "block"; |
112 | document.getElementById("uuidv6_info").style.display = "block"; |
114 | } |
113 | } |
115 | </script> |
114 | </script> |
- | 115 | <p><a id="uuidv6_info_button" href="javascript:show_uuidv6_info()">Show format</a> |
|
116 | <pre id="uuidv6_info" style="display:none">Variant 1, Version 6 UUID: |
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> |
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) |
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> |
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) |
120 | - 2 bit Variant (fix 0b10) |
Line 142... | Line 142... | ||
142 | 142 | ||
143 | <h3 id="gen_uuidv4">Generate random (version 4) UUID 🎲</h3> |
143 | <h3 id="gen_uuidv4">Generate random (version 4) UUID 🎲</h3> |
144 | 144 | ||
145 | <p><i>A UUIDv4 is made of 122 random bits. No other information is encoded in this kind of UUID.</i></p> |
145 | <p><i>A UUIDv4 is made of 122 random bits. No other information is encoded in this kind of UUID.</i></p> |
146 | 146 | ||
147 | <p><a id="uuidv4_info_button" href="javascript:show_uuidv4_info()">Show format</a> |
- | |
148 | <script> |
147 | <script> |
149 | function show_uuidv4_info() { |
148 | function show_uuidv4_info() { |
150 | document.getElementById("uuidv4_info_button").style.display = "none"; |
149 | document.getElementById("uuidv4_info_button").style.display = "none"; |
151 | document.getElementById("uuidv4_info").style.display = "block"; |
150 | document.getElementById("uuidv4_info").style.display = "block"; |
152 | } |
151 | } |
153 | </script> |
152 | </script> |
- | 153 | <p><a id="uuidv4_info_button" href="javascript:show_uuidv4_info()">Show format</a> |
|
154 | <pre id="uuidv4_info" style="display:none">Variant 1, Version 4 UUID: |
154 | <pre id="uuidv4_info" style="display:none">Variant 1, Version 4 UUID: |
155 | - 48 bit Random High |
155 | - 48 bit Random High |
156 | - 4 bit Version (fix 0x4) |
156 | - 4 bit Version (fix 0x4) |
157 | - 12 bit Random Mid |
157 | - 12 bit Random Mid |
158 | - 2 bit Variant (fix 0b10) |
158 | - 2 bit Variant (fix 0b10) |
Line 179... | Line 179... | ||
179 | <h3 id="gen_uuidv1">Generate time-based (version 1) UUID ⏰</h3> |
179 | <h3 id="gen_uuidv1">Generate time-based (version 1) UUID ⏰</h3> |
180 | 180 | ||
181 | <p><i>A UUIDv1 is made of the MAC address of the generating computer, |
181 | <p><i>A UUIDv1 is made of the MAC address of the generating computer, |
182 | the time, and a clock sequence.</i></p> |
182 | the time, and a clock sequence.</i></p> |
183 | 183 | ||
184 | <p><a id="uuidv1_info_button" href="javascript:show_uuidv1_info()">Show format</a> |
- | |
185 | <script> |
184 | <script> |
186 | function show_uuidv1_info() { |
185 | function show_uuidv1_info() { |
187 | document.getElementById("uuidv1_info_button").style.display = "none"; |
186 | document.getElementById("uuidv1_info_button").style.display = "none"; |
188 | document.getElementById("uuidv1_info").style.display = "block"; |
187 | document.getElementById("uuidv1_info").style.display = "block"; |
189 | } |
188 | } |
190 | </script> |
189 | </script> |
- | 190 | <p><a id="uuidv1_info_button" href="javascript:show_uuidv1_info()">Show format</a> |
|
191 | <pre id="uuidv1_info" style="display:none">Variant 1, Version 1 UUID: |
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> |
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> |
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) |
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> |
195 | - 12 bit High <abbr title="Count of 100ns intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr> |
Line 227... | Line 227... | ||
227 | initially designed by Apollo Computer that cannot be generated anymore, because the |
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>. |
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: |
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> |
230 | <a href="interprete_uuid.php?uuid=ffffffff-ffff-0000-027f-000001000000"><code>ffffffff-ffff-0000-027f-000001000000</code></a>.</p> |
231 | 231 | ||
232 | <p><a id="uuidnce_info_button" href="javascript:show_uuidnce_info()">Show format</a> |
- | |
233 | <script> |
232 | <script> |
234 | function show_uuidnce_info() { |
233 | function show_uuidnce_info() { |
235 | document.getElementById("uuidnce_info_button").style.display = "none"; |
234 | document.getElementById("uuidnce_info_button").style.display = "none"; |
236 | document.getElementById("uuidnce_info").style.display = "block"; |
235 | document.getElementById("uuidnce_info").style.display = "block"; |
237 | } |
236 | } |
238 | </script> |
237 | </script> |
- | 238 | <p><a id="uuidnce_info_button" href="javascript:show_uuidnce_info()">Show format</a> |
|
239 | <pre id="uuidnce_info" style="display:none">Variant 0 UUID: |
239 | <pre id="uuidnce_info" style="display:none">Variant 0 UUID: |
240 | - 32 bit High <abbr title="Count of 4µs intervals passed since 1 Jan 1980 00:00:00 GMT">Time</abbr> |
240 | - 32 bit High <abbr title="Count of 4µs intervals passed since 1 Jan 1980 00:00:00 GMT">Time</abbr> |
241 | - 16 bit Low <abbr title="Count of 4µs intervals passed since 1 Jan 1980 00:00:00 GMT">Time</abbr> |
241 | - 16 bit Low <abbr title="Count of 4µs intervals passed since 1 Jan 1980 00:00:00 GMT">Time</abbr> |
242 | - 16 bit Reserved |
242 | - 16 bit Reserved |
243 | - 1 bit Variant (fix 0b0) |
243 | - 1 bit Variant (fix 0b0) |
Line 260... | Line 260... | ||
260 | <h3 id="gen_uuidv2">Generate DCE Security (version 2) UUID</h3> |
260 | <h3 id="gen_uuidv2">Generate DCE Security (version 2) UUID</h3> |
261 | 261 | ||
262 | <p><i>An UUIDv2 contains information about the creator (person, group, or organization), the generating system (MAC address), and time. |
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> |
263 | The creator information replaced parts of the time bits, therefore the time resolution is very low.</i></p> |
264 | 264 | ||
265 | <p><a id="uuidv2_info_button" href="javascript:show_uuidv2_info()">Show format</a> |
- | |
266 | <script> |
265 | <script> |
267 | function show_uuidv2_info() { |
266 | function show_uuidv2_info() { |
268 | document.getElementById("uuidv2_info_button").style.display = "none"; |
267 | document.getElementById("uuidv2_info_button").style.display = "none"; |
269 | document.getElementById("uuidv2_info").style.display = "block"; |
268 | document.getElementById("uuidv2_info").style.display = "block"; |
270 | } |
269 | } |
271 | </script> |
270 | </script> |
- | 271 | <p><a id="uuidv2_info_button" href="javascript:show_uuidv2_info()">Show format</a> |
|
272 | <pre id="uuidv2_info" style="display:none">Variant 1, Version 2 UUID: |
272 | <pre id="uuidv2_info" style="display:none">Variant 1, Version 2 UUID: |
273 | - 32 bit Local Domain Number |
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> |
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) |
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> |
276 | - 12 bit High <abbr title="Count of 429.4967296s intervals passed since 15 Oct 1582 00:00:00 GMT">Time</abbr> |
Line 287... | Line 287... | ||
287 | <label>Domain (8 bits):</label><select name="domain_choose" id="dce_domain_choice" onchange="javascript:dce_domain_choose();"> |
287 | <label>Domain (8 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> |
288 | <option value="uid">Person (e.g. POSIX UID)</option> |
289 | <option value="gid">Group (e.g. POSIX GID)</option> |
289 | <option value="gid">Group (e.g. POSIX GID)</option> |
290 | <option value="org">Organization</option> |
290 | <option value="org">Organization</option> |
291 | <option value="site">Site-defined</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> |
292 | </select> = Address Family ID: <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 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> |
293 | <label>Value (32 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, |
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> |
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 UUIDv2"> |
296 | <input type="hidden" name="uuid" value="CREATE"> <input type="submit" value="Create UUIDv2"> |
297 | </form> |
297 | </form> |
Line 319... | Line 319... | ||
319 | <p><i>An UUIDv3 is made out of a MD5 hash and an UUIDv5 is made out of a SHA1 hash. |
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 |
320 | The revision of RFC4122 also contains an example for a custom UUIDv8 that |
321 | allows SHA2, SHA3 and SHAKE hash algorithms. ViaThinkSoft added more hash |
321 | allows SHA2, SHA3 and SHAKE hash algorithms. ViaThinkSoft added more hash |
322 | algorithms and assigned Hash Space IDs to them.</i></p> |
322 | algorithms and assigned Hash Space IDs to them.</i></p> |
323 | 323 | ||
324 | <p><a id="uuidv35_info_button" href="javascript:show_uuidv35_info()">Show format</a> |
- | |
325 | <script> |
324 | <script> |
326 | function show_uuidv35_info() { |
325 | function show_uuidv35_info() { |
327 | document.getElementById("uuidv35_info_button").style.display = "none"; |
326 | document.getElementById("uuidv35_info_button").style.display = "none"; |
328 | document.getElementById("uuidv35_info").style.display = "block"; |
327 | document.getElementById("uuidv35_info").style.display = "block"; |
329 | } |
328 | } |
330 | </script> |
329 | </script> |
- | 330 | <p><a id="uuidv35_info_button" href="javascript:show_uuidv35_info()">Show format</a> |
|
331 | <pre id="uuidv35_info" style="display:none">Variant 1, Version 3/5/8 UUID: |
331 | <pre id="uuidv35_info" style="display:none">Variant 1, Version 3/5/8 UUID: |
332 | - 48 bit Hash High |
332 | - 48 bit Hash High |
333 | - 4 bit Version (fix 0x3, 0x5, or 0x8) |
333 | - 4 bit Version (fix 0x3, 0x5, or 0x8) |
334 | - 12 bit Hash Mid |
334 | - 12 bit Hash Mid |
335 | - 2 bit Variant (fix 0b10) |
335 | - 2 bit Variant (fix 0b10) |
- | 336 | - 62 bit Hash Low |
|
- | 337 | ||
- | 338 | ||
- | 339 | ||
- | 340 | <u>Overview of namebased UUIDs:</u> |
|
- | 341 | UUIDv3(<i>NamespaceUuid</i>, <i>Data</i>) := <abbr title="Adds UUID variant 0b10 and version 3">ConvertRawBytesToUuid_v3</abbr>(MD5( Binary[<i>NameSpaceUuid</i>] || <i>Data</i> )). |
|
- | 342 | UUIDv5(<i>NamespaceUuid</i>, <i>Data</i>) := <abbr title="Adds UUID variant 0b10 and version 5">ConvertRawBytesToUuid_v5</abbr>(SHA1( Binary[<i>NameSpaceUuid</i>] || <i>Data</i> )). |
|
336 | - 62 bit Hash Low</pre></p> |
343 | UUIDv8(<i>HashAlgo</i>, <i>NameSpaceUuid</i>, <i>Data</i>) := <abbr title="Adds UUID variant 0b10 and version 8">ConvertRawBytesToUuid_v8</abbr>(<i>HashAlgo</i>( Binary[HashSpaceUuid<<i>HashAlgo</i>>] || Binary[<i>NameSpaceUuid</i>] || <i>Data</i> )). |
- | 344 | ||
- | 345 | <u>As defined by RFC4122 Appendix C / RFC4122bis Appendix A:</u> |
|
- | 346 | NameSpaceUuid<DNS> := "6ba7b810-9dad-11d1-80b4-00c04fd430c8". |
|
- | 347 | NameSpaceUuid<URL> := "6ba7b811-9dad-11d1-80b4-00c04fd430c8". |
|
- | 348 | NameSpaceUuid<OID> := "6ba7b812-9dad-11d1-80b4-00c04fd430c8". |
|
- | 349 | NameSpaceUuid<X500> := "6ba7b814-9dad-11d1-80b4-00c04fd430c8". |
|
- | 350 | ||
- | 351 | <u>As defined by RFC4122bis Appendix B:</u> |
|
- | 352 | HashSpaceUuid<SHA2_224> := "59031ca3-fbdb-47fb-9f6c-0f30e2e83145". |
|
- | 353 | HashSpaceUuid<SHA2_256> := "3fb32780-953c-4464-9cfd-e85dbbe9843d". |
|
- | 354 | HashSpaceUuid<SHA2_384> := "e6800581-f333-484b-8778-601ff2b58da8". |
|
- | 355 | HashSpaceUuid<SHA2_512> := "0fde22f2-e7ba-4fd1-9753-9c2ea88fa3f9". |
|
- | 356 | HashSpaceUuid<SHA2_512_224> := "003c2038-c4fe-4b95-a672-0c26c1b79542". |
|
- | 357 | HashSpaceUuid<SHA2_512_256> := "9475ad00-3769-4c07-9642-5e7383732306". |
|
- | 358 | HashSpaceUuid<SHA3_224> := "9768761f-ac5a-419e-a180-7ca239e8025a". |
|
- | 359 | HashSpaceUuid<SHA3_256> := "2034d66b-4047-4553-8f80-70e593176877". |
|
- | 360 | HashSpaceUuid<SHA3_384> := "872fb339-2636-4bdd-bda6-b6dc2a82b1b3". |
|
- | 361 | HashSpaceUuid<SHA3_512> := "a4920a5d-a8a6-426c-8d14-a6cafbe64c7b". |
|
- | 362 | HashSpaceUuid<SHAKE_128> := "7ea218f6-629a-425f-9f88-7439d63296bb". |
|
- | 363 | HashSpaceUuid<SHAKE_256> := "2e7fc6a4-2919-4edc-b0ba-7d7062ce4f0a". |
|
- | 364 | ||
- | 365 | <u>As defined by ViaThinkSoft for all other algorithms:</u> |
|
- | 366 | HashSpaceUuid<<i>HashAlgo</i>> := UUIDv5("1ee317e2-1853-64b2-8fe9-3c4a92df8582", <a href="https://www.php.net/manual/de/function.hash-algos.php">PhpName</a>[<i>HashAlgo</i>]). |
|
- | 367 | which results in the following UUIDs: |
|
- | 368 | <?php |
|
- | 369 | ||
- | 370 | $tmp = []; |
|
- | 371 | ||
- | 372 | foreach (get_uuidv8_hash_space_ids() as list($algo,$space,$friendlyName,$author,$available)) { |
|
- | 373 | $line = str_pad('HashSpaceUuid<'.htmlentities($friendlyName).'>', 34, ' ', STR_PAD_RIGHT); |
|
- | 374 | $line .= ':= "'.$space.'".'; |
|
- | 375 | if (!$available) $line .= " (Currently not available on this system)"; |
|
- | 376 | $line .= "\n"; |
|
- | 377 | ||
- | 378 | $tmp[$friendlyName] = $line; |
|
- | 379 | } |
|
- | 380 | ||
- | 381 | ksort($tmp); |
|
- | 382 | foreach ($tmp as $line) { |
|
- | 383 | echo $line; |
|
- | 384 | } |
|
- | 385 | ||
- | 386 | ?> |
|
- | 387 | ||
- | 388 | ||
- | 389 | </pre></p> |
|
337 | 390 | ||
338 | <style> |
391 | <style> |
339 | label { |
392 | label { |
340 | width:120px; |
393 | width:120px; |
341 | text-align:left; |
394 | text-align:left; |
Line 348... | Line 401... | ||
348 | <label>Hash algorithm:</label><select name="version" id="nb_version" onchange="javascript:nb_version_choose();"> |
401 | <label>Hash algorithm:</label><select name="version" id="nb_version" onchange="javascript:nb_version_choose();"> |
349 | <?php |
402 | <?php |
350 | $tmp = []; |
403 | $tmp = []; |
351 | $tmp['MD5'] = '<option value="3">MD5 (UUIDv3)</option>'; |
404 | $tmp['MD5'] = '<option value="3">MD5 (UUIDv3)</option>'; |
352 | $tmp['SHA1'] = '<option value="5" selected>SHA1 (UUIDv5)</option>'; |
405 | $tmp['SHA1'] = '<option value="5" selected>SHA1 (UUIDv5)</option>'; |
353 | foreach (get_uuidv8_hash_space_ids() as list($algo,$space,$friendlyname,$author)) { |
406 | foreach (get_uuidv8_hash_space_ids() as list($algo,$space,$friendlyName,$author,$available)) { |
- | 407 | if ($available) { |
|
354 | $tmp[$friendlyname] = '<option value="8_namebased_'.$space.'">'.htmlentities($friendlyname).' (UUIDv8 defined by '.htmlentities($author).')</option>'; |
408 | $tmp[$friendlyName] = '<option value="8_namebased_'.$space.'">'.htmlentities($friendlyName).' (UUIDv8 defined by '.htmlentities($author).')</option>'; |
- | 409 | } |
|
355 | } |
410 | } |
356 | ksort($tmp); |
411 | ksort($tmp); |
357 | foreach ($tmp as $html) { |
412 | foreach ($tmp as $html) { |
358 | echo "\t\t$html\n"; |
413 | echo "\t\t$html\n"; |
359 | } |
414 | } |
Line 462... | Line 517... | ||
462 | 517 | ||
463 | <h3 id="gen_uuidv8"><font color="green">New:</font> Generate Custom (version 8) UUID</h3> |
518 | <h3 id="gen_uuidv8"><font color="green">New:</font> Generate Custom (version 8) UUID</h3> |
464 | 519 | ||
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> |
520 | <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> |
466 | 521 | ||
467 | <p><a id="uuidv8_info_button" href="javascript:show_uuidv8_info()">Show format</a> |
- | |
468 | <script> |
522 | <script> |
469 | function show_uuidv8_info() { |
523 | function show_uuidv8_info() { |
470 | document.getElementById("uuidv8_info_button").style.display = "none"; |
524 | document.getElementById("uuidv8_info_button").style.display = "none"; |
471 | document.getElementById("uuidv8_info").style.display = "block"; |
525 | document.getElementById("uuidv8_info").style.display = "block"; |
472 | } |
526 | } |
473 | </script> |
527 | </script> |
- | 528 | <p><a id="uuidv8_info_button" href="javascript:show_uuidv8_info()">Show format</a> |
|
474 | <pre id="uuidv8_info" style="display:none">Variant 1, Version 8 UUID: |
529 | <pre id="uuidv8_info" style="display:none">Variant 1, Version 8 UUID: |
475 | - 48 bit Custom data |
530 | - 48 bit Custom data |
476 | - 4 bit Version (fix 0x8) |
531 | - 4 bit Version (fix 0x8) |
477 | - 12 bit Custom data |
532 | - 12 bit Custom data |
478 | - 2 bit Variant (fix 0b10) |
533 | - 2 bit Variant (fix 0b10) |
Line 541... | Line 596... | ||
541 | 596 | ||
542 | <form method="GET" action="interprete_mac.php"> |
597 | <form method="GET" action="interprete_mac.php"> |
543 | <input type="text" name="mac" value="" style="width:250px"> <input type="submit" value="Interprete"> |
598 | <input type="text" name="mac" value="" style="width:250px"> <input type="submit" value="Interprete"> |
544 | </form> |
599 | </form> |
545 | 600 | ||
546 | <h3 id="gen_aai">Generate an AAI</h3> |
601 | <h3 id="gen_aai">Generate an <abbr title="Administratively Assigned Identifier">AAI</abbr></h3> |
547 | 602 | ||
548 | <p><i>An Administratively Assigned Identifier (AAI) is a MAC address which can be locally defined |
603 | <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> |
604 | by applications or an administrator. Unlike the EUI, an AAI is NOT worldwide unique.</i></p> |
550 | 605 | ||
551 | <form method="GET" action="interprete_mac.php"> |
606 | <form method="GET" action="interprete_mac.php"> |