Subversion Repositories uuid_mac_utils

Compare Revisions

Regard whitespace Rev 63 → Rev 64

/trunk/includes/uuid_utils.inc.php
30,10 → 30,11
if (file_exists($f = __DIR__ . '/OidDerConverter.class.php')) include_once $f;
else if (file_exists($f = __DIR__ . '/OidDerConverter.class.phps')) include_once $f;
 
const UUID_NAMEBASED_NS_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; // FQDN
// Note: The RFC allows various notations as payload, not a strict notation constraint
const UUID_NAMEBASED_NS_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
const UUID_NAMEBASED_NS_URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
const UUID_NAMEBASED_NS_OID = '6ba7b812-9dad-11d1-80b4-00c04fd430c8';
const UUID_NAMEBASED_NS_X500_DN = '6ba7b814-9dad-11d1-80b4-00c04fd430c8'; // "DER or text encoding" according to RFC4122bis
const UUID_NAMEBASED_NS_X500_DN = '6ba7b814-9dad-11d1-80b4-00c04fd430c8';
 
if (!function_exists('_random_int')) {
function _random_int($min, $max) {
324,7 → 325,7
} else if (($version >= 3) && ($version <= 5)) {
echo sprintf("%-32s %s\n", "Variant:", "[0b10_] RFC 4122 (Leach-Mealling-Salz)");
} else if (($version >= 6) && ($version <= 8)) {
echo sprintf("%-32s %s\n", "Variant:", "[0b10_] RFC 4122bis (Leach-Mealling-Peabody-Davis)");
echo sprintf("%-32s %s\n", "Variant:", "[0b10_] RFC 4122bis (Davis-Peabody-Leach)"); // TODO: When new RFC is published, replace the RFC number
} else {
echo sprintf("%-32s %s\n", "Variant:", "[0b10_] RFC 4122?");
}
1319,7 → 1320,7
function get_uuidv8_hash_space_ids(): array {
$out = array();
 
// The following Hash Space UUIDs are defined in the RFC4122bis as Example for Namebased UUIDv8
// The following Hash Space UUIDs are defined in RFC4122bis as Example for Namebased UUIDv8 [ TODO: When new RFC is published, replace the RFC number in this comment ]
$out[] = ['sha224', '59031ca3-fbdb-47fb-9f6c-0f30e2e83145', 'SHA2-224', 'RFC Example', PHP_VERSION_ID >= 70100];
$out[] = ['sha256', '3fb32780-953c-4464-9cfd-e85dbbe9843d', 'SHA2-256', 'RFC Example', PHP_VERSION_ID >= 70100];
$out[] = ['sha384', 'e6800581-f333-484b-8778-601ff2b58da8', 'SHA2-384', 'RFC Example', PHP_VERSION_ID >= 70100];
/trunk/index.php
3,7 → 3,7
/*
* UUID & MAC Utils
* Copyright 2017 - 2023 Daniel Marschall, ViaThinkSoft
* Version 2023-08-04
* Version 2023-08-14
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
342,13 → 342,13
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> )).
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&lt;<i>HashAlgo</i>&gt;] || Binary[<i>NameSpaceUuid</i>] || <i>Data</i> )).
 
<u>As defined by RFC4122 Appendix C / RFC4122bis Appendix A:</u>
<u>As defined by <a href="https://datatracker.ietf.org/doc/rfc4122/">RFC4122</a> Appendix C / <a href="https://datatracker.ietf.org/doc/draft-ietf-uuidrev-rfc4122bis/">RFC4122bis</a> Appendix A:</u><!-- TODO: When new RFC is published, replace the RFC number -->
NameSpaceUuid&lt;DNS&gt; := "6ba7b810-9dad-11d1-80b4-00c04fd430c8".
NameSpaceUuid&lt;URL&gt; := "6ba7b811-9dad-11d1-80b4-00c04fd430c8".
NameSpaceUuid&lt;OID&gt; := "6ba7b812-9dad-11d1-80b4-00c04fd430c8".
NameSpaceUuid&lt;X500&gt; := "6ba7b814-9dad-11d1-80b4-00c04fd430c8".
 
<u>As defined by RFC4122bis Appendix B:</u>
<u>As defined by <a href="https://datatracker.ietf.org/doc/draft-ietf-uuidrev-rfc4122bis/">RFC4122bis</a> Appendix B:</u><!-- TODO: When new RFC is published, replace the RFC number -->
HashSpaceUuid&lt;SHA2_224&gt; := "59031ca3-fbdb-47fb-9f6c-0f30e2e83145".
HashSpaceUuid&lt;SHA2_256&gt; := "3fb32780-953c-4464-9cfd-e85dbbe9843d".
HashSpaceUuid&lt;SHA2_384&gt; := "e6800581-f333-484b-8778-601ff2b58da8".