ISO/IEC 9834-8:2014 情報技術—オブジェクト識別子登録機関の操作手順—パート8:ユニバーサル一意識別子(UUID)の生成とオブジェクト識別子でのそれらの使用 | ページ 6

※一部、英文及び仏文を自動翻訳した日本語訳を使用しています。

3 用語と定義

この勧告の目的のために |国際規格では、次の定義が適用されます。

3.1 ASN.1 表記

この推奨事項 |国際標準では、ITU-T X.680 | で定義されている次の用語が使用されます。 ISO/IEC 8824-1:

  • a)協定世界時 (UTC)
  • b)オブジェクト識別子のタイプ。
  • c) OID 国際化されたリソース識別子のタイプ。

3.2 登録機関

この推奨事項 |国際標準では、ITU-T X.660 | で定義されている次の用語が使用されます。 ISO/IEC 9834-1:

  • a)国際オブジェクト識別子ツリー。
  • b) IRI/URI 値。
  • c) OID 国際化リソース識別子。
  • d)オブジェクト識別子。
  • e)登録。 2
  • f)登録機関。
  • g)登録手順。
  • h)二次識別子。
  • i) Unicode 文字。
  • j) Unicode ラベル。

3.3 ネットワーク用語

この推奨事項 |国際規格では、ISO/IEC 8802-3 で定義されている次の用語が使用されます。

  • MACアドレス。

3.4 追加の定義

3.4.1

暗号品質の乱数

メカニズムによって生成される乱数または擬似乱数。暗号化作業での使用が許容されるように、繰り返し生成される値が十分に拡散することを保証します (およびそのような作業で使用されます)

3.4.2

ジョイント UUID アーク

ASN.1 オブジェクト識別子の値{joint-iso-itu-t(2) uuid(25)} と ASN.1 OID 国際化リソース識別子の値 "/UUID" によって識別される、国際オブジェクト識別子ツリーのノードの下にあるアーク。

3.4.3

名前ベースのバージョン

ネームスペース名とそのネームスペース内の名前の暗号化ハッシュを使用して生成される UUI

3.4.4

ネームスペース

名前空間内での明確な識別を保証する、オブジェクトの名前を生成するシステム。

注記 1:名前空間の例としては、ネットワーク・ドメイン・ネーム・システム、URN, OID, ディレクトリ識別名 ([1] を参照)、およびプログラミング言語の予約語などがあります。

3.4.5

乱数ベースのバージョン

乱数または擬似乱数を使用して生成される UUI

3.4.6

標準 UUID バリアント

この推奨事項で指定されている可能な UUID 形式のバリアント |国際標準。

注 1: 歴史的には、この推奨事項で指定されているバリアントとは異なる UUID 形式の仕様が他にも存在しました。国際標準。これらすべてのバリアント形式に従って生成された UUID はすべて個別です。

3.4.7

時間ベースのバージョン

システムを識別するためのMACアドレスと、現在のUTC時刻に基づくClock値を使用して一意性が得られるUUI

3.4.8

普遍的に一意の識別子

UUID

この勧告に従って生成された 128 ビット値 |国際標準、またはいくつかの歴史的な仕様に従って、システム間および時間の経過とともに固有の値を提供します(3.4.6 も参照)。

4つの略語

この勧告の目的のために |国際規格では、次の略語が適用されます。

ASN.1抽象構文表記 1
GUIDグローバルに一意識別子
マックメディアアクセス制御
MD5メッセージダイジェストアルゴリズム5
OIDオブジェクト識別子
OID IRIOID 国際化リソース識別子
SHA-1安全なハッシュ アルゴリズム 1
URLユニフォームリソースロケーター
統一リソース名
UTC協定世界時
UUID普遍的に一意の識別子

5表記

5.1この推奨事項 |国際標準では、最初と最後という用語を使用して UUID のオクテットのシーケンスを指定します。最初のオクテットは「オクテット 15」、最後のオクテットは「オクテット 0」とも呼ばれます。

5.2 UUID 内のビットには、「ビット 127」から「ビット 0」までの番号も付けられます。ビット 127 はオクテット 15 の最上位ビット、ビット 0 はオクテット 0 の最下位ビットです。

5.3この勧告で図と表が使用される場合 |国際標準では、最上位オクテット (および最上位ビット) がページの左側に表示されます。これは、左端のオクテットが最初に送信されるオクテットの送信順序に対応します。

5.4この仕様で使用される多くの値は、特定のビット長 (N 個) の符号なし整数の値として表現されます。 N ビットの符号なし整数値のビットには、「ビット N-1」から「ビット 0」までの番号が付けられ、ビット N-1 が最上位ビット、ビット 0 が最下位ビットとなります。

5.5これらの表記は、この仕様の目的のみに使用されます。コンピュータ メモリ内の表現は標準化されておらず、システム アーキテクチャに依存します。

6 UUID の構造と表現

6.1 UUIDフィールド構造

6.1.1 UUID は、6 つのフィールドの順序付けられたシーケンスとして指定されます。 UUID は、これらの UUID フィールドの連結によって指定されます。 UUID フィールドの名前は次のとおりです。

  • a) 「TimeLow」フィールド。
  • b) 「TimeMid」フィールド。
  • c) 「VersionAndTimeHigh」フィールド。
  • d) 「VariantAndClockSeqHigh」フィールド。
  • e) 「ClockSeqLow」フィールド。
  • f) 「ノード」フィールド。

6.1.2 UUID フィールドは、上記の順序で意味を持つように定義されており、「TimeLow」が最上位フィールド (「TimeLow」のビット 31 は UUID のビット 127)、「Node」が最下位フィールド (「Node」のビット 0 は UUID のビット 0) となります。

6.1.3これらの UUID フィールドの内容は、バージョン、バリアント、時間、クロック シーケンス、およびノー​​ドの符号なし整数値 (それぞれ固定ビット サイズ) で指定されます。これらの値の設定は条項 12 で指定され、上記の UUID フィールドへのマッピングは 12.1 で指定されます。

注 —一部の UUID フィールド (TimeLow, TimeMid, TimeHigh など) の名前の一部が暗示しているように、特定の符号なし整数値 (Time 値のビット 59 から 0 など) から派生する UUID 内のビットの順序 (ビット 127 からビット 0) は、その符号なし整数値内のビットの順序と同じではありません。これは歴史的な理由によるものです。

6.2 バイナリ表現

6.2.1 UUID は、各フィールドの符号なし整数の固定長エンコーディングを 1 つ以上のオクテットに連結して形成される 16 オクテットとしてバイナリで表現されます。各フィールドに使用されるオクテットの数は次のとおりです。

  • a) 「TimeLow」フィールド: 4 オクテット。
  • b) 「TimeMid」フィールド: 2 オクテット。
  • c) 「VersionAndTimeHigh」フィールド: 2 オクテット。
  • d) 「VariantAndClockSeqHigh」フィールド:1オクテット。
  • e) 「ClockSeqLow」フィールド:1オクテット。
  • f) 「ノード」フィールド: 6 オクテット。

注 — UUID フィールドのこの順序は、コンピュータ システム内での通常の表現であり、16 進テキスト表現での表現です (6.4 を参照)

6.2.2各 UUID フィールドの符号なし整数エンコーディングの最上位ビットは、最初のオクテットの最上位ビット (オクテット N, 最上位オクテット) とし、符号なし整数エンコーディングの最下位ビットは、最後のオクテットの最下位ビット (オクテット 0, 最下位ビット) とする。

6.2.3 UUID フィールドは、その重要性の順に連結され (6.1.2 を参照)、最上位フィールドが最初、最下位フィールドが最後になります。

6.3 単一の整数値としての表現

UUID は単一の整数値として表すことができます。 UUID の単一の整数値を取得するには、バイナリ表現の 16 オクテットを、整数エンコーディングの最上位ビットを 16 オクテットの最初のオクテット (オクテット 15) の最上位ビット (ビット 7) とし、最下位ビットを 16 オクテットの最後のオクテット (オクテット 0) の最下位ビット (ビット 0) として、符号なし整数エンコーディングとして処理する必要があります。

注 —単一の整数値は、第 7 項で指定されているように、UUID がジョイント UUID アークの主整数値を形成する場合に使用されます。

6.4 16 進数表現

16 進形式の場合、バイナリ形式のオクテットは、バイナリ形式の各オクテットに 2 つの 16 進数を使用した 16 進数の文字列で表されます。最初の桁はオクテット 15 の上位 4 ビットの値、2 番目はオクテット 15 の下位 4 ビットの値、というように続き、最後はオクテットの下位ビットの値になります。 0 (6.5 を参照)ハイフン-マイナス (45) 文字 (ISO/IEC 10646 を参照) は、「VariantAndClockSeqHigh」フィールドと「ClockSeqLow」フィールドの間を除く、隣接するフィールドの各ペアの 16 進表現の間に挿入されます (条項 8 の例を参照)

6.5 16 進表現の正式な構文

6.5.1 UUID 16 進表現構文の正式な定義は、拡張 BNF を使用して指定されます。

ITU-T X.680 | で定義されている表記法。 ISO/IEC 8824-1, 第 5 項に準拠します。ただし、語彙項目の間に空白を入れてはなりません。

6.5.2 「hexdigit」字句項目は BNF 仕様で使用され、次のように定義されます。

字句項目の名前 — 16 進数

「16 進数字」は、次の文字のうち 1 つだけで構成されます。

ABCDEF abcdef 0 1 2 3 4 5 6 7 8 9

6.5.3 UUID の 16 進表現は、製品版の「UUID」となります。

UUID::=
時間低い
"-" 時間中
"-" バージョンと時刻高
「-」 VariantAndClockSeqHigh ClockSeqLow
「-」ノード
低時間::=
16 進数オクテット 16 進数オクテット 16 進数オクテット 16 進数オクテット
時間中::=
16 進オクテット 16 進オクテット
バージョンと時間の高さ::=
16 進オクテット 16 進オクテット
VariantAndClockSeqHigh::=
16 進オクテット
ClockSeqLow::=
16 進オクテット
ノード::=
16 進数オクテット 16 進数オクテット 16 進数オクテット 16 進数オクテット 16 進数オクテット 16 進数オクテット
16 進オクテット::=
16 進数 16 進数


6.5.4 UUID の 16 進表現を生成するソフトウェアでは、大文字を使用しないものとします。

注 –人間が判読できるすべての形式で使用される 16 進表現は小文字に制限することをお勧めします。ただし、この表現を処理するソフトウェアは、6.5.2 で指定されているように、大文字と小文字の両方を受け入れる必要があります。

7 ジョイント UUID アークの主整数値および Unicode ラベルとしての UUID の使用

7.1 UUID は、6.3 で指定された UUID の単一の整数値を使用して、ジョイント UUID アークの主整数値として使用できます。

7.2 6.4 で定義された UUID の 16 進表現は、アークの非整数 Unicode ラベルとしても使用できます。

例 -

以下は、UUID を使用して IRI/URI 値を形成する例です。

8 URN を形成するための UUID の使用

UUID を使用して形成された URN (IETF RFC 2141 を参照) は、文字列「 urn: uuid: 」の後に 6.4 で定義された UUID の 16 進表現が続きます。

例 -

以下は、URN としての UUID の文字列表現の例です: urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6

注 —代替の URN 形式 ([2] を参照) も利用できますが、UUID を使用して生成された URN には推奨されません。この代替形式は、6.3 で指定された UUID の単一の整数値を使用し、上記の例を「 urn:oid:2.25.329800735698586629295641978511506172918 」として表します。

9 UUID の比較と順序付けのルール

9.1 UUID のペアを比較するには、各 UUID の対応するフィールド (6.1 を参照) の値を重要度の順に比較します (6.1.2 を参照) 2 つの UUID が等しいのは、対応するすべてのフィールドが等しい場合に限ります。

注 1 — 2 つの UUID を比較するこのアルゴリズムは、6.3 で指定された単一の整数表現の値の比較と同等です。

注 2 —この比較では、6.1.3 にリストされ、第 12 条 (時間、クロック シーケンス、バリアント、バージョン、およびノー​​ド) に指定されている値ではなく、6.1.1 に指定されている物理フィールドが使用されます。

9.2 UUID は、異なる最上位フィールドの値が大きい場合、別の UUID より大きいとみなされます。

9.3 UUID の 16 進表現の辞書編集順では (6.4 を参照)、より大きな UUID はより小さな UUID の後に続くものとします。

10 検証

バリアント ビットが正しく設定されているかどうか、および時間ベースの UUID で使用される Time 値が将来のものである (したがってまだ割り当て可能ではない) かどうかを判断すること以外に、UUID が実際の意味で有効であるかどうかを判断するメカニズムはありません。そうでない場合は、考えられるすべての値が発生する可能性があります。

11のバリアントビット

11.1バリアント ビットは、「VariantAndClockSeqHigh」フィールドの最上位オクテットであるオクテット 7 の最上位 3 ビット (ビット 7, 6, および 5) です。

11.2この勧告に準拠するすべての UUID |国際標準には、オクテット 7 のビット 7 が 1 に設定され、オクテット 7 のビット 6 が 0 に設定されたバリアント ビットが含まれます。オクテット 7 のビット 5 はクロック シーケンスの最上位ビットであり、12.4 に従って設定されます。

注 —ビット 5 は、その値が歴史的なフォーマットを区別するため、ここではバリアント ビットとしてリストされています。厳密に言えば、これはこの推奨事項のバリアント値の一部ではありません。国際標準。バリアントに 2 ビットのみを使用します。

11.3表 1 は、参考までに、バリアント ビットの他の値の使用を示しています。

表 1 —バリアント ビットの使用

ビット7ビット6ビット5説明
0--NCS の下位互換性を提供するために予約されています
10-この推奨事項で指定されているバリアント |国際規格
110Microsoft Corporation の下位互換性を提供するために予約されています
111この推奨事項によって将来使用するために予約されています。国際規格

12 UUIDフィールドの使用と送信バイトオーダー

12.1 一般

12.1.1表 2 は、バイナリ表現におけるさまざまな UUID フィールドの位置と使用法をまとめたものです。

表 2 — UUID フィールドの位置と使用法

分野UUIDのオクテット番号説明
「タイムロー」15-12Time 値の下位ビット (32 ビット)
「タイムミッド」11-10時間値の中間ビット (16 ビット)
「バージョンと時間の高さ」9-8バージョン (4 ビット) とそれに続く時間値の上位ビット (12 ビット)
「VariantAndClockSeqHigh」7バリアント ビット (2 ビット) とそれに続くクロック シーケンスの上位ビット (6 ビット)
「クロックシーケンスロー」6クロックシーケンスの下位ビット(8ビット)
"ノード"5-0ノード (12.5 を参照) (48 ビット)

12.1.2バイナリ表現における UUID フィールドの位置を図 1 に示します。

図 1 —バイナリ表現における UUID フィールドの位置

12.1.3通信メカニズムを介した送信にはバイナリ表現を使用し、バイナリ表現の 16 オクテットを連続した 16 ビットのセットとして送信し、送信では最初のオクテット (オクテット 15) が最後のオクテット (オクテット 0) に先行するようにすることが推奨されます。

注 1 —オクテット内のビットの順序は、通信メカニズムの仕様によって決まります。

注 2 — UUID の送信には、上で指定した順序で連続 16 オクテットを使用することが推奨されますが、プロトコル仕様では、UUID の一部のみ (時間値に寄与する部分など) の断片化や送信など、UUID を転送する代替手段が選択される場合があります。

12.2バージョン

12.2.1 UUID を生成する 3 つの代替手段 (時間ベース、名前ベース、および乱数ベース) は、「VersionAndTimeHigh」フィールドの最上位 4 ビット (UUID のオクテット 9 のビット 7 ~ 4) によって識別および区別されます。これらの異なるメカニズムを使用して生成された UUID は、「異なる UUID バージョン」と呼ばれます。

注 –これを「異なる UUID バージョン」と説明すると若干誤解を招きますが、この名前は歴史的な理由から使用されています。 UUID 形式には従来の「バージョン番号」という概念はありません。ここで, 新しいバージョンがこの推奨事項のリビジョンとして定義される可能性があります。国際標準。将来必要となる新しい UUID 形式は、バリアント ビットの異なる値によって識別されます。

12.2.2表 3 は、「VersionAndTimeHigh」フィールドの最初の 4 ビット (UUID のオクテット 9 のビット 7 ~ 4) を使用して、現在定義されている「UUID バージョン」をリストします。また、ビットの各組み合わせに整数の「バージョン」値を割り当てます。

注 — UUID の過去の定義との互換性のために、バージョン値 2 は使用されません。バージョン値 0 および 6 ~ 15 は、将来の使用のために予約されています。

表 3 -現在定義されている UUID バージョン

ビット7ビット6ビット5ビット4バージョン値説明
00011この推奨事項で指定されている時間ベースのバージョン |国際規格 (第 13 項を参照)
00102DCE セキュリティ バージョン用に予約されており、POSIX UUID が埋め込まれています
00113この推奨事項で指定されている名前ベースのバージョン | MD5 ハッシュを使用した国際標準 (第 14 項を参照)
01004この推奨事項で指定されている乱数ベースのバージョン |国際規格 (第 15 項を参照)
01015この推奨事項で指定されている名前ベースのバージョン | SHA-1 ハッシュを使用した国際標準 (第 14 項を参照)

12.3 時間

12.3.1 時間は 60 ビット値でなければなりません。

注 — 「Time」という名前は、UUID の時間ベースのバージョン (バージョン 1) に適していますが、UUID の他のバージョン (バージョン 3 および 4) の対応する値の内容にも使用されます。

12.3.2 UUID の時間ベースのバージョンの場合、時間は、1582 年 10 月 15 日 (西暦へのグレゴリオ暦改革の日) の開始時の午前 0 時からの協定世界時 (UTC) の 100 ナノ秒間隔のカウントとなります。

注 1 —国際時間局 (国際時間局) が設立される前は、1 分に正確に 60 秒が含まれていました。それ以来、必要に応じてうるう秒が発生し、年間の秒数が増加 (または潜在的に減少) しています。

注 2 —ポータブル システムは、ホームベースの現地時間に固定されていることが多いため、UTC 時間を決定する際に問題が発生する可能性があります。ホームベースの現地時間を使用し続けるか、クロック シーケンス値 (12.4 を参照) を変更する場合、生成される UUID は依然として一意です。

注 3 —放送時刻信号にアクセスできないシステムの場合、夏時間からの変更が発生する期間、またはクロック シーケンス値 (12.4 を参照) の変更が行われる期間に UUID が生成されない限り、現地時間を記録するシステム クロックに時差を追加して使用できます。

12.3.3 UUID の名前ベースのバージョンの場合、これはグローバルに一意の名前から構築された 60 ビット値でなければなりません

第 14 条に規定されているとおり。

注 —グローバルに一意な名前の例としては、OID, URN, ディレクトリ識別名があります ([1] を参照)

12.3.4 UUID の乱数ベースのバージョンの場合、これは第 15 項で指定されているように、ランダムまたは擬似ランダムに生成された 60 ビット値となります。

12.4 クロックシーケンス

12.4.1 UUID の時間ベースのバージョンでは、Time の値が逆に設定された場合や Node の値が変更された場合に発生する可能性のある重複を回避するためにクロック シーケンスが使用されます。

注 — 「クロック シーケンス」という名前は、UUID の時間ベースのバージョンに適していますが、UUID の名前ベースおよび乱数ベースのバージョンの対応する値の内容にも使用されます。

12.4.2時間値が逆に設定されている場合、または逆に設定されている可能性がある場合(たとえば、システムの電源がオフになっている間)、UUID ジェネレーターは、現在時間に設定されている値よりも大きい時間値で UUID がすでに生成されているかどうかを知ることができません。このような状況では、クロック シーケンスの値が変更されます。

注 —クロック シーケンスの前の値がわかっている場合は、値を増やすだけで済みます。それ以外の場合は、暗号品質のランダム値または擬似ランダム値に設定する必要があります。

12.4.3同様に、ノード値が変更された場合 (たとえば、ネットワーク カードがマシン間で移動されたため)、クロック シーケンス値も変更されます。

12.4.4クロック シーケンスは、最初に (つまり、UUID を生成するシステムの存続期間に 1 回)、ノード値から導出されない乱数に初期化されます。

注 –これは、システム間の相関関係を最小限に抑え、システム間で急速に移動または切り替えられる MAC アドレスに対して最大限の保護を提供するためです。

12.4.5 UUID の名前ベースのバージョンの場合、クロック シーケンスは、第 14 項で指定されている名前から構築された 14 ビット値でなければなりません。

12.4.6 UUID の乱数ベースのバージョンの場合、クロック シーケンスは、第 15 項で指定されているように、ランダムまたは擬似ランダムに生成された 14 ビット値でなければなりません。

12.5ノード

12.5.1 UUID の時間ベースのバージョンの場合、ノード値は MAC アドレス (ISO/IEC 8802-3 を参照)、通常はネットワーク インターフェイスのホスト アドレスで構成されます。

12.5.2複数の MAC アドレスを持つシステムの場合、マルチキャスト アドレスを除く、使用可能な任意のアドレスを使用できます。 UUID のオクテット 5 (「ノード」の最初のオクテット) は、ISO/IEC 8802-3 準拠のシステムによって送信される MAC アドレスの最初のオクテットに設定されます。

注 1 —このオクテットには、グローバル/ローカル ビットとユニキャスト/マルチキャスト ビットが含まれます。 12.5.3 に従って生成されたアドレスとの衝突を避けるために、ユニキャスト/マルチキャスト ビットをユニキャストに設定する必要があります。

注 2 — MAC アドレス登録機関から MAC アドレスのブロックを取得することが可能です ([4] を参照)

12.5.3 MAC アドレスのないシステムの場合、暗号品質の乱数または擬似乱数が使用される場合があります (付録 C を参照)マルチキャストビットはそのようなアドレスに設定されます。

注 –これは、生成されたアドレスが 12.5.2 で指定されているネットワーク カードから取得されたアドレスと競合しないようにするためです。

12.5.4名前ベースの UUID の場合、ノード値は、第 14 項で指定されているグローバルに一意な名前からの正規化とハッシュによって構築された 48 ビット値でなければなりません。

12.5.5乱数ベースの UUID の場合、ノード値は、第 15 項で指定されているように、ランダムまたは擬似ランダムに生成された 48 ビット値でなければなりません。

13 時間ベースの UUID フィールドの設定

時間ベースの UUID のフィールドは次のように設定されます。

  • 12.3 および 12.4 で指定されているように、UUID で使用される UTC ベースの時刻とクロック シーケンスの値を決定します。
  • このアルゴリズムでは、時間を 60 ビットの符号なし整数、クロック シーケンスを 14 ビットの符号なし整数とみなします。各値のビットに連続した番号を付けます。最下位ビットは 0 になります。
  • 「TimeLow」フィールドを、同じ重要度の順序で Time の最下位 32 ビット (ビット 31 ~ 0) に等しく設定します。
  • 「TimeMid」フィールドを、同じ重要度の順序で時刻からのビット 47 ~ 32 に設定します。
  • 「VersionAndTimeHigh」フィールドの最下位 12 ビット (ビット 11 ~ 0) を、同じ重要度の順序で Time のビット 59 ~ 48 に等しく設定します。
  • 「VersionAndTimeHigh」フィールドの最上位 4 ビット (ビット 15 ~ 12) を、12.2 で指定された 4 ビットのバージョン番号に設定します。
  • 「ClockSeqLow」フィールドをクロック シーケンスの最下位 8 ビット (ビット 7 ~ 0) に同じ重要度の順序で設定します。
  • 「VariantAndClockSeqHigh」フィールドの 6 つの最下位ビット (ビット 5 ~ 0) を、同じ重要度の順序でクロック シーケンスの 6 つの最上位ビット (ビット 13 ~ 8) に設定します。
  • 「VariantAndClockSeqHigh」クロックの 2 つの最上位ビット (ビット 7 と 6) をそれぞれ 1 と 0 に設定します。
  • ノード フィールドを、アドレスと同じ重要度の順序で 48 ビット MAC アドレスに設定します。

14 名前ベースの UUID のフィールドの設定

この句は、名前ベースの UUID を生成する手順を指定します。 14.1 節では、ハッシュ関数の一般的な手順を指定します (ISO/IEC 10118-3 も参照)サブ条項 14.2 では MD5 の使用を指定し、サブ条項 14.3 では SHA-1 の使用を指定します。

注 - SHA-1 は、異なるハッシュ化されたマテリアルから同じハッシュ値が生成される確率がより低いハッシュ アルゴリズムを提供するため、MD5 の使用は既存の UUID との下位互換性が必要な場合に限定されます (C.4 を参照)

14.1名前ベースの UUID のフィールドは次のように設定されます。

  • その名前空間内の名前から生成されるすべての UUID の「名前空間識別子」として使用する UUID を割り当てます。

    注 —サブ条項 D.9 では、一般的に使用される 4 つの名前空間に UUID を使用することが推奨されています。

  • 名前をオクテットの正規シーケンス (名前空間の標準または規則によって定義される) に変換します。
  • 14.2 または 14.3 で指定されたハッシュ関数を使用して、名前と連結された名前空間識別子の 16 オクテットのハッシュ値を計算します。ハッシュ値のオクテットの番号付けは、IETF RFC 1321 (MD5 の場合) および FIPS PUB 180-3 (SHA-1 の場合) で指定されているように、0 ~ 15 です。
  • 「TimeLow」フィールドのオクテット 3 ~ 0 をハッシュ値のオクテット 3 ~ 0 に設定します。
  • 「TimeMid」フィールドのオクテット 1 と 0 をハッシュ値のオクテット 5 と 4 に設定します。
  • 「VersionAndTimeHigh」フィールドのオクテット 1 と 0 をハッシュ値のオクテット 7 と 6 に設定します。
  • 「VersionAndTimeHigh」フィールドの最上位 4 ビット (ビット 15 ~ 12) を、使用されたハッシュ関数の 12.2 の表 3 の 4 ビットのバージョン番号で上書きします。
  • 「VariantAndClockSeqHigh」フィールドをハッシュ値のオクテット 8 に設定します。
  • 「VariantAndClockSeqHigh」フィールドの 2 つの最上位ビット (ビット 7 と 6) をそれぞれ 1 と 0 で上書きします。
  • 「ClockSeqLow」フィールドをハッシュ値のオクテット 9 に設定します。
  • 「Node」フィールドのオクテット 5 ~ 0 をハッシュ値のオクテット 15 ~ 10 に設定します。

14.2この節では、ハッシュ関数として MD5 を使用する名前ベースの UUID を指定しますが、新しく生成される UUID には MD5 を使用しません (C.4 を参照) MD5 ハッシュ関数の場合、14.1 で参照される「ハッシュ値」は、IETF RFC 1321 によってオクテット 0 ~ 15 として指定されている 16 オクテット値です。

注 — MD5 のこの仕様と関連するバージョン番号は、以前の仕様との下位互換性を目的としてのみ含まれています。

14.3この節では、ハッシュ関数として SHA-1 を使用する名前ベースの UUID を指定します。 SHA-1 ハッシュ関数の場合、14.1 で参照される「ハッシュ値」は、FIPS PUB 180-3 で指定された 160 ビットのメッセージ ダイジェスト値から取得された 20 オクテット値の 0 ~ 15 オクテットでなければなりません。 20 オクテット値のうちのオクテット 16 ~ 19 は破棄されます。 20 オクテット値は、160 ビット値の最上位ビットを 20 オクテット値の最初のオクテット (オクテット 0) の最上位ビットに配置し、最下位ビットを 20 オクテット値の最後のオクテット (オクテット 19) に配置することにより、FIPS PUB 180-3 の 160 ビット メッセージ ダイジェスト値から取得されます。

15 乱数ベースの UUID フィールドの設定

15.1乱数ベースの UUID のフィールドは次のように設定されます。

  • 「VariantAndClockSeqHigh」フィールドの 2 つの最上位ビット (ビット 7 と 6) をそれぞれ 1 と 0 に設定します。
  • 「VersionAndTimeHigh」フィールドの最上位 4 ビット (ビット 15 ~ 12) を、12.2 で指定された 4 ビットのバージョン番号に設定します。
  • UUID の他のすべてのビットをランダム (または擬似ランダム) に生成された値に設定します。

    注 —擬似乱数は同じ値を複数回生成する場合があります。値が繰り返される可能性を減らすために、暗号品質の乱数を使用することを強くお勧めします。

15.2付録 C は、システム内で乱数を生成する方法に関するガイダンスを提供します。

参考文献

1勧告 ITU-T X.500 (2012) | ISO/IEC 9594-1: 2012, 情報技術 — オープン システム相互接続 — ディレクトリ: 概念、モデル、サービスの概要。
2IETF RFC 306, オブジェクト識別子の URN 名前空間。
3IETF RFC 412, Universally Unique Identifier (UUID) URN 名前空間。
4IEEE, 4,096 MAC アドレスの個別アドレス ブロック (イーサネット アドレス ブロックとも呼ばれる) のリクエスト フォーム。 http://standards.ieee.org/develop/regauth/iab/
5ISO/IEC 11578:1996, 情報技術 - オープン システム相互接続 - リモート プロシージャ Cal1 (RPC)
6オープン グループ CAE: DCE:リモート プロシージャ コール、仕様 C309, ISBN 1-85912-041-5, 1994 年 8 月。
7Zahn, L.、Dineen, T.、Leach, P. (1990 年 1 月)、 『Network Computing Architecture』 、ISBN 0-13-611674-

3 Terms and definitions

For the purposes of this Recommendation | International Standard, the following definitions apply.

3.1 ASN.1 notation

This Recommendation | International Standard uses the following terms defined in Rec. ITU-T X.680 | ISO/IEC 8824-1:

  • a) Coordinated universal time (UTC);
  • b) object identifier type;
  • c) OID internationalized resource identifier type.

3.2 Registration authorities

This Recommendation | International Standard uses the following terms defined in Rec. ITU-T X.660 | ISO/IEC 9834-1:

  • a) International Object Identifier tree;
  • b) IRI/URI value;
  • c) OID internationalized resource identifier;
  • d) object identifier;
  • e) registration;2
  • f) registration authority;
  • g) registration procedures;
  • h) secondary identifier;
  • i) Unicode character;
  • j) Unicode label.

3.3 Network terms

This Recommendation | International Standard uses the following term defined in ISO/IEC 8802-3:

  • MAC address.

3.4 Additional definitions

3.4.1

cryptographic-quality random-number

A random number or pseudo-random number generated by a mechanism, which ensures sufficient spread of repeatedly-generated values to be acceptable for use in cryptographic work (and is used in such work).

3.4.2

Joint UUID arc

An arc beneath the node of the International Object Identifier tree identified by the ASN.1 object identifier value{joint-iso-itu-t(2) uuid(25)} and the ASN.1 OID internationalized resource identifier value "/UUID" .

3.4.3

name-based version

A UUID that is generated using cryptographic hashing of a name space name and a name in that name space.

3.4.4

name space

A system for generating names of objects that ensures unambiguous identification within that name space.

Note 1 to entry: Examples of name spaces are the network domain name system, URNs, OIDs, Directory distinguished names (see [1]), and reserved words in a programming language.

3.4.5

random-number-based version

A UUID that is generated using a random or pseudo-random number.

3.4.6

standard UUID variant

The variant of the possible UUID formats that is specified by this Recommendation | International Standard.

Note 1 to entry: Historically, there have been other specifications of UUID formats that differ from the variant specified in this Recommendation | International Standard. UUIDs generated according to all these variant formats are all distinct.

3.4.7

time-based version

A UUID in which uniqueness is obtained by the use of a MAC address to identify a system, and a Clock value based on the current UTC time.

3.4.8

universally unique identifier

UUID

A 128-bit value generated in accordance with this Recommendation | International Standard, or in accordance with some historical specifications, and providing unique values between systems and over time (see also 3.4.6).

4 Abbreviations

For the purposes of this Recommendation | International Standard, the following abbreviations apply:

ASN.1Abstract Syntax Notation One
GUIDGlobally Unique Identifier
MACMedia Access Control
MD5Message Digest algorithm 5
OIDObject Identifier
OID-IRIOID internationalized resource identifier
SHA-1Secure Hash Algorithm 1
URLUniform Resource Locator
URNUniform Resource Name
UTCCoordinated Universal Time
UUIDUniversally Unique Identifier

5 Notation

5.1 This Recommendation | International Standard specifies a sequence of octets for a UUID using the terms first and last. The first octet is also called"octet 15" and the last octet"octet 0".

5.2 The bits within a UUID are also numbered as"bit 127" to"bit 0", with bit 127 as the most significant bit of octet 15 and bit 0 as the least significant bit of octet 0.

5.3 When figures and tables are used in this Recommendation | International Standard, the most significant octet (and the most significant bit) are displayed on the left of the page. This corresponds with a transmission order of octets in which the left-most octets are transmitted first.

5.4 A number of values used in this Specification are expressed as the value of an unsigned integer of a given bit-length (N say). The bits of the N-bit unsigned integer value are numbered"bit N-1" to"bit 0", with bit N-1 as the most significant bit and bit 0 as the least significant bit.

5.5 These notations are used solely for the purposes of this Specification. Representations in computer memory are not standardized, and depend on the system architecture.

6 UUID structure and representation

6.1 UUID field structure

6.1.1 A UUID is specified as an ordered sequence of six fields. A UUID is specified in terms of the concatenation of these UUID fields. The UUID fields are named:

  • a) the"TimeLow" field;
  • b) the"TimeMid" field;
  • c) the"VersionAndTimeHigh" field;
  • d) the"VariantAndClockSeqHigh" field;
  • e) the"ClockSeqLow" field;
  • f) the"Node" field.

6.1.2 The UUID fields are defined to have a significance in the order listed above, with"TimeLow" as the most significant field (bit 31 of"TimeLow" is bit 127 of the UUID), and"Node" as the least significant field (bit 0 of"Node" is bit 0 of the UUID).

6.1.3 The contents of these UUID fields are specified in terms of a Version, Variant, Time, Clock Sequence, and Node unsigned integer value (each with a fixed bit-size). The setting of these values is specified in clause 12 and their mapping to the above UUID fields is specified in 12.1.

NOTE — As part of the names of some of the UUID fields (for example, TimeLow, TimeMid, and TimeHigh) imply, the sequential order of the bits in a UUID (bit 127 to bit 0) that derive from a particular unsigned integer value (for example, from bits 59 to 0 of the Time value) is not the same as the sequential order of the bits in that unsigned integer value. This is for historical reasons.

6.2 Binary representation

6.2.1 A UUID shall be represented in binary as 16 octets formed by the concatenation of the unsigned integer fixed-length encoding of each of its fields into one or more octets. The number of octets to be used for each field shall be:

  • a) the"TimeLow" field: four octets;
  • b) the"TimeMid" field: two octets;
  • c) the"VersionAndTimeHigh" field: two octets;
  • d) the"VariantAndClockSeqHigh" field: one octet;
  • e) the"ClockSeqLow" field: one octet;
  • f) the"Node" field: six octets.

NOTE — This order of UUID fields is the usual representation within a computer system, and in the hexadecimal text representation (see 6.4).

6.2.2 The most significant bit of the unsigned integer encoding of each UUID field shall be the most significant bit of its first octet (octet N, the most significant octet), and the least significant bit of the unsigned integer encoding shall be the least significant bit of its last octet (octet 0, the least significant bit).

6.2.3 The UUID fields shall be concatenated in the order of their significance (see 6.1.2) with the most significant field first and the least significant field last.

6.3 Representation as a single integer value

A UUID can be represented as a single integer value. To obtain the single integer value of the UUID, the 16 octets of the binary representation shall be treated as an unsigned integer encoding with the most significant bit of the integer encoding as the most significant bit (bit 7) of the first of the sixteen octets (octet 15) and the least significant bit as the least significant bit (bit 0) of the last of the sixteen octets (octet 0).

NOTE — The single integer value is used when the UUID forms the primary integer value of a Joint UUID arc as specified in clause 7.

6.4 Hexadecimal representation

For the hexadecimal format, the octets of the binary format shall be represented by a string of hexadecimal digits, using two hexadecimal digits for each octet of the binary format, the first being the value of the four high-order bits of octet 15, the second being the value of the four low-order bits of octet 15, and so on, with the last being the value of the low-order bits of octet 0 (see 6.5). A HYPHEN-MINUS (45) character (see ISO/IEC 10646) shall be inserted between the hexadecimal representations of each pair of adjacent fields, except between the"VariantAndClockSeqHigh" field and the"ClockSeqLow" field (see the example in clause 8).

6.5 Formal syntax of the hexadecimal representation

6.5.1 The formal definition of the UUID hexadecimal representation syntax is specified using the extended BNF

notation defined in Rec. ITU-T X.680 | ISO/IEC 8824-1, clause 5, except that there shall be no white-space between the lexical items.

6.5.2 The"hexdigit" lexical item is used in the BNF specification and is defined as follows:

Name of lexical item — hexdigit

A"hexdigit" shall consist of exactly one of the characters:

A B C D E F a b c d e f 0 1 2 3 4 5 6 7 8 9

6.5.3 The hexadecimal representation of a UUID shall be the production"UUID":

UUID::=
TimeLow
"-" TimeMid
"-" VersionAndTimeHigh
"-" VariantAndClockSeqHigh ClockSeqLow
"-" Node
TimeLow::=
HexOctet HexOctet HexOctet HexOctet
TimeMid::=
HexOctet HexOctet
VersionAndTimeHigh::=
HexOctet HexOctet
VariantAndClockSeqHigh::=
HexOctet
ClockSeqLow::=
HexOctet
Node::=
HexOctet HexOctet HexOctet HexOctet HexOctet HexOctet
HexOctet::=
hexdigit hexdigit


6.5.4 Software generating the hexadecimal representation of a UUID shall not use upper case letters.

NOTE — It is recommended that the hexadecimal representation used in all human-readable formats be restricted to lower-case letters. Software processing this representation is, however, required to accept both upper and lower case letters as specified in 6.5.2.

7 Use of a UUID as the primary integer value and Unicode label of a Joint UUID arc

7.1 A UUID can be used as the primary integer value of a Joint UUID arc using the single integer value of the UUID specified in 6.3.

7.2 The hexadecimal representation of the UUID defined in 6.4 can also be used as a non-integer Unicode label for the arc.

EXAMPLE —

The following is an example of the use of a UUID to form an IRI/URI value:

8 Use of a UUID to form a URN

A URN (see IETF RFC 2141) formed using a UUID shall be the string " urn: uuid: " followed by the hexadecimal representation of a UUID defined in 6.4.

EXAMPLE —

The following is an example of the string representation of a UUID as a URN: urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6

NOTE — An alternative URN format (see [2]) is available, but is not recommended for URNs generated using UUIDs. This alternative format uses the single integer value of the UUID specified in 6.3, and represents the above example as " urn:oid:2.25.329800735698586629295641978511506172918 ".

9 Rules for comparison and ordering of UUIDs

9.1 To compare a pair of UUIDs, the values of the corresponding fields (see 6.1) of each UUID are compared, in order of significance (see 6.1.2). Two UUIDs are equal if and only if all the corresponding fields are equal.

NOTE 1 — This algorithm for comparing two UUIDs is equivalent to the comparison of the values of the single integer representations specified in 6.3.

NOTE 2 — This comparison uses the physical fields specified in 6.1.1 not the values listed in 6.1.3 and specified in clause 12 (Time, Clock Sequence, Variant, Version, and Node).

9.2 A UUID is considered greater than another UUID if it has a larger value for the most significant field in which they differ.

9.3 In a lexicographical ordering of the hexadecimal representation of UUIDs (see 6.4), a larger UUID shall follow a smaller UUID.

10 Validation

Apart from determining if the variant bits are set correctly, and that the Time value used in a time-based UUID is in the future (and therefore not yet assignable), there is no mechanism for determining if a UUID is valid in any real sense, as all possible values can otherwise occur.

11 Variant bits

11.1 The variant bits are the most significant three bits (bits 7, 6, and 5) of octet 7, which is the most significant octet of the"VariantAndClockSeqHigh" field.

11.2 All UUIDs conforming to this Recommendation | International Standard shall have variant bits with bit 7 of octet 7 set to 1 and bit 6 of octet 7 set to 0. Bit 5 of octet 7 is the most significant bit of the Clock Sequence and shall be set in accordance with 12.4.

NOTE — Bit 5 is listed here as a variant bit because its value distinguishes historical formats. Strictly speaking, it is not part of the variant value for this Recommendation | International Standard, which uses only two bits for the variant.

11.3 Table 1 lists, for information, the use of other values of the variant bits.

Table 1 — Use of the variant bits

Bit 7Bit 6Bit 5Description
0--Reserved to provide NCS backward compatibility
10-The variant specified in this Recommendation | International Standard
110Reserved to provide Microsoft Corporation backward compatibility
111Reserved for future use by this Recommendation | International Standard

12 Use of UUID fields and transmission byte order

12.1 General

12.1.1 Table 2 gives the position and summarizes the use of the various UUID fields in the binary representation.

Table 2 — Position and use of UUID fields

FieldOctet # in UUIDDescription
"TimeLow"15-12The low-order bits of the Time value (32 bits)
"TimeMid"11-10The middle bits of the Time value (16 bits)
"VersionAndTimeHigh"9-8The Version (4 bits) followed by the high-order bits of the Time value (12 bits)
"VariantAndClockSeqHigh"7The Variant bits (2 bits) followed by the high-order bits of the Clock Sequence (6 bits)
"ClockSeqLow"6The low-order bits of the Clock Sequence (8 bits)
"Node"5-0The Node (see 12.5) (48 bits)

12.1.2 The position of the UUID fields in the binary representation is illustrated in Figure 1.

Figure 1 — Position of UUID fields in the binary representation

12.1.3 It is recommended that the binary representation be used for transmission over a communication mechanism, with the sixteen octets of the binary representation transmitted as a contiguous set of sixteen bits with the first octet (octet 15) preceding the last octet (octet 0) in the transmission.

NOTE 1 — The order of the bits within an octet is determined by the communication mechanism specification.

NOTE 2 — The use of sixteen consecutive octets for transmission of a UUID, in the order specified above, is recommended, but protocol specifications may choose alternative means of transferring a UUID, including fragmentation or transmission of only portions of the UUID (such as the parts that contribute to the Time value).

12.2 Version

12.2.1 The three alternative means of generating a UUID (time-based, name-based, and random-number-based) are identified and distinguished by the most significant four bits of the"VersionAndTimeHigh" field (bits 7 to 4 of octet 9 of the UUID). UUIDs generated using these different mechanisms are called"different UUID versions".

NOTE — Describing this as a"different UUID version" is slightly misleading, but the name is used for historical reasons. There is no concept of a traditional"version number" for UUID formats ここで, new versions may be defined as a revision of this Recommendation | International Standard. Any new UUID format needed in the future would be identified by a different value of the variant bits.

12.2.2 Table 3 lists currently defined"UUID versions", using the first four bits of the"VersionAndTimeHigh" field (bits 7 to 4 of octet 9 of the UUID). It also assigns an integer"Version" value to each combination of bits.

NOTE — A version value of 2 is not used, for compatibility with historical definitions of the UUID. Version values of 0 and 6 to 15 are reserved for future use.

Table 3 — Currently defined UUID versions

Bit 7Bit 6Bit 5Bit 4Version valueDescription
00011The time-based version specified in this Recommendation | International Standard (see clause 13)
00102Reserved for DCE Security version, with embedded POSIX UUIDs
00113The name-based version specified in this Recommendation | International Standard with MD5 hash (see clause 14)
01004The random-number-based version specified in this Recommendation | International Standard (see clause 15)
01015The name-based version specified in this Recommendation | International Standard with SHA-1 hash (see clause 14)

12.3 Time

12.3.1 Time shall be a 60-bit value.

NOTE — The name"Time" is appropriate for the time-based version of a UUID (version 1), but is also used for the contents of the corresponding value in the other versions of a UUID (versions 3 and 4).

12.3.2 For the time-based version of a UUID, Time shall be a count of the 100 nanosecond intervals of coordinated universal time (UTC) since the midnight at the start of the 15 October 1582 (the date of the Gregorian reform to the Christian calendar).

NOTE 1 — Before the establishment of the Bureau International de l'Heure (International Time Bureau), every minute contained precisely sixty seconds. Since then, leap seconds have occurred when necessary, increasing (or potentially reducing) the number of seconds per year.

NOTE 2 — Portable systems may have problems determining UTC time, as they are often locked into the local time of their home base. Provided that they continue using the local time of their home base, or change the Clock Sequence value (see 12.4), the UUIDs that they generate will still be unique.

NOTE 3 — For systems that do not have access to broadcast time signals, a system clock recording local time can be used with a time differential added, provided that no UUIDs are generated in the period when a change from daylight saving time occurs, or a change in the Clock Sequence value (see 12.4) is made.

12.3.3 For the name-based version of a UUID, this shall be a 60-bit value constructed from a globally unique name

as specified in clause 14.

NOTE — Examples of a globally unique name are OIDs, URNs, and Directory distinguished names (see [1]).

12.3.4 For the random-number-based version of a UUID, this shall be a randomly or pseudo-randomly generated 60-bit value as specified in clause 15.

12.4 Clock sequence

12.4.1 For the time-based version of the UUID, the Clock Sequence is used to help avoid duplicates that could arise when the value of Time is set backwards or if the Node value is changed.

NOTE — The name"Clock Sequence" is appropriate for the time-based version of a UUID, but is also used for the contents of the corresponding value in the name-based and random-number-based versions of a UUID.

12.4.2 If the Time value is set backwards, or might have been set backwards (for example, while the system was powered off), then the UUID generator cannot know whether a UUID has already been generated with Time values larger than the value to which the Time is now set. In such situations, the Clock Sequence value shall be changed.

NOTE — If the previous value of the Clock Sequence is known, it can be just incremented; otherwise it should be set to a cryptographic-quality random or pseudo-random value.

12.4.3 Similarly, if the Node value changes (for example, because a network card has been moved between machines), the Clock Sequence value shall be changed.

12.4.4 The Clock Sequence shall be originally (that is, once in the lifetime of a system producing UUIDs) initialized to a random number that is not derived from the Node value.

NOTE — This is in order to minimize the correlation across systems, providing maximum protection against MAC addresses that may move or switch from system to system rapidly.

12.4.5 For the name-based version of the UUID, the Clock Sequence shall be a 14-bit value constructed from a name as specified in clause 14.

12.4.6 For the random-number-based version of the UUID, the Clock Sequence shall be a randomly or pseudo-randomly generated 14-bit value as specified in clause 15.

12.5 Node

12.5.1 For the time-based version of a UUID, the Node value shall consist of a MAC address (see ISO/IEC 8802-3), usually the host address of some network interface.

12.5.2 For systems with multiple MAC addresses, any available address can be used except a multicast address. Octet 5 of the UUID (the first octet of the"Node") shall be set to the first octet of the MAC address that is transmitted by an ISO/IEC 8802-3-conformant system.

NOTE 1 — This octet contains the global/local bit and the unicast/multicast bit. It is required that the unicast/multicast bit be set to unicast in order to avoid clashes with addresses generated in accordance with 12.5.3.

NOTE 2 — It is possible to obtain a block of MAC addresses from the MAC address registration authority (see [4]).

12.5.3 For systems with no MAC address, a cryptographic-quality random or pseudo-random number may be used (see Annex C). The multicast bit shall be set in such addresses.

NOTE — This is to ensure that the generated addresses never conflict with addresses obtained from network cards as specified in 12.5.2.

12.5.4 For a name-based UUID, the Node value shall be a 48-bit value constructed by canonicalization and hashing from a globally unique name as specified in clause 14.

12.5.5 For a random-number-based UUID, the Node value shall be a randomly or pseudo-randomly generated 48-bit value as specified in clause 15.

13 Setting the fields of a time-based UUID

The fields of a time-based UUID shall be set as follows:

  • Determine the values for the UTC-based Time and the Clock Sequence to be used in the UUID, as specified in 12.3 and 12.4.
  • For the purposes of this algorithm, consider Time to be a 60-bit unsigned integer and the Clock Sequence to be a 14-bit unsigned integer. Sequentially number the bits in each value, with zero for the least significant bit.
  • Set the"TimeLow" field equal to the least significant 32 bits (bits 31 through 0) of Time in the same order of significance.
  • Set the"TimeMid" field equal to bits 47 through 32 from the Time in the same order of significance.
  • Set the 12 least significant bits (bits 11 through 0) of the"VersionAndTimeHigh" field equal to bits 59 through 48 from Time in the same order of significance.
  • Set the four most significant bits (bits 15 through 12) of the"VersionAndTimeHigh" field to the four-bit version number specified in 12.2.
  • Set the"ClockSeqLow" field to the eight least significant bits (bits 7 through 0) of the Clock Sequence in the same order of significance.
  • Set the six least significant bits (bits 5 through 0) of the"VariantAndClockSeqHigh" field to the six most significant bits (bits 13 through 8) of the Clock Sequence in the same order of significance.
  • Set the two most significant bits (bits 7 and 6) of the"VariantAndClockSeqHigh" clock to one and zero, respectively.
  • Set the node field to the 48-bit MAC address in the same order of significance as the address.

14 Setting the fields of a name-based UUID

This clause specifies the procedures for the production of a name-based UUID. Subclause 14.1 specifies the general procedures for any hash function (see also ISO/IEC 10118-3). Subclause 14.2 specifies the use of MD5, and 14.3 specifies the use of SHA-1.

NOTE— The use of MD5 is restricted to cases requiring backward compatibility with existing UUIDs, as SHA-1 provides a hashing algorithm with a smaller probability that the same hash value will arise from different hashed material (see C.4).

14.1 The fields of a name-based UUID shall be set as follows:

  • Allocate a UUID to use as a"name space identifier" for all UUIDs generated from names in that name space.

    NOTE — Subclause D.9 recommends UUIDs to use for four commonly used name spaces.

  • Convert the name to a canonical sequence of octets (as defined by the standards or conventions of its name space).
  • Compute the 16-octet hash value of the name space identifier concatenated with the name, using the hash function specified in 14.2 or 14.3. The numbering of the octets in the hash value is from 0 to 15, as specified in IETF RFC 1321 (for MD5) and as specified in FIPS PUB 180-3 (for SHA-1).
  • Set octets 3 through 0 of the"TimeLow" field to octets 3 through 0 of the hash value.
  • Set octets 1 and 0 of the"TimeMid" field to octets 5 and 4 of the hash value.
  • Set octets 1 and 0 of the"VersionAndTimeHigh" field to octets 7 and 6 of the hash value.
  • Overwrite the four most significant bits (bits 15 through 12) of the"VersionAndTimeHigh" field with the four-bit version number from Table 3 of 12.2 for the hash function that was used.
  • Set the"VariantAndClockSeqHigh" field to octet 8 of the hash value.
  • Overwrite the two most significant bits (bits 7 and 6) of the"VariantAndClockSeqHigh" field with 1 and 0, respectively.
  • Set the"ClockSeqLow" field to octet 9 of the hash value.
  • Set octets 5 through 0 of the"Node" field to octets 15 through 10 of the hash value.

14.2 This subclause specifies a name-based UUID using MD5 as a hash function, but MD5 shall not be used for newly generated UUIDs (see C.4). For an MD5 hash function, the"hash value" referenced in 14.1 is the 16-octet value specified by IETF RFC 1321 as octets zero to 15.

NOTE — This specification of MD5, with the associated version number, is included only for backward compatibility with earlier specifications.

14.3 This subclause specifies a name-based UUID using SHA-1 as a hash function. For a SHA-1 hash function, the"hash value" referenced in 14.1 shall be octets zero to 15 of the 20-octet value obtained from the 160-bit Message Digest value specified by FIPS PUB 180-3. Octets 16 to 19 of the 20-octet value shall be discarded. The 20-octet value shall be obtained from the 160-bit Message Digest value of FIPS PUB 180-3 by placing the most significant bit of the 160-bit value in the most significant bit of the first octet (octet zero) of the 20-octet value, and the least significant bit in the last octet (octet 19) of the 20-octet value.

15 Setting the fields of a random-number-based UUID

15.1 The fields of a random-number-based UUID shall be set as follows:

  • Set the two most significant bits (bits 7 and 6) of the"VariantAndClockSeqHigh" field to 1 and 0, respectively.
  • Set the four most significant bits (bits 15 through 12) of the"VersionAndTimeHigh" field to the four-bit version number specified in 12.2.
  • Set all the other bits of the UUID to randomly (or pseudo-randomly) generated values.

    NOTE — Pseudo-random numbers may produce the same value multiple times. The use of cryptographic-quality random numbers is strongly recommended in order to reduce the probability of repeated values.

15.2 Annex C provides guidance on how to generate random numbers in a system.

Bibliography

1Recommendation ITU-T X.500 (2012) | ISO/IEC 9594-1: 2012, Information technology — Open Systems Interconnection — The Directory: Overview of concepts, models and services.
2IETF RFC 3061 (2001), A URN Namespace of Object Identifiers.
3IETF RFC 4122 (2005), A Universally Unique Identifier (UUID) URN Namespace.
4IEEE, Request Form for an Individual Address Block (also known as an Ethernet Address Block) of 4,096 MAC Addresses. http://standards.ieee.org/develop/regauth/iab/
5ISO/IEC 11578: 1996, Information technology — Open Systems Interconnection — Remote Procedure Cal1 (RPC).
6Open Group CAE: DCE: Remote Procedure Call, Specification C309, ISBN 1-85912-041-5, August 1994.
7Zahn, L., Dineen, T., Leach, P. (January 1990), Network Computing Architecture, ISBN 0-13-611674-4.