From 4df2a9e2e460d88f27350c5e3eb98015ca7eef2b Mon Sep 17 00:00:00 2001 From: bcoe Date: Sat, 23 Jan 2021 19:15:58 -0800 Subject: [PATCH 01/12] feat: describe UUID v4 algorithm Refs: #5 --- index.html | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index a09800f..dcc7bae 100644 --- a/index.html +++ b/index.html @@ -93,10 +93,148 @@

Extensions to the Crypto interface

         [Exposed=(Window,Worker)]
-        partial interface Crypto {
+        partial interface Crypto {
           DOMString randomUUID();
         };
       
+
+

The randomUUID() method.

+ The + randomUUID() + method steps are: +
    +
  1. +

    + Let array be a new Uint16Array with 8 elements. +

    +
  2. +
  3. +

    + Overwrite all elements of array with cryptographically random values of + a 16-bit unsigned integer type. +

    +
  4. +
  5. +

    + Let timeLow be an 8 character hexadecimal string + populated as follows: +

    +
      +
    • +

      + Let a be the 4 character hexadecimal representation + of array[0], left padding the string with + "0" until 4 characters are reached. +

      +
    • +
    • +

      + Let b be the 4 character hexadecimal representation + of array[1], left padding the string with + "0" until 4 characters are reached. +

      +
    • +
    • +

      + Set timeLow equal to a appended to + b (left to right). +

      +
    • +
    +
  6. +
  7. +

    + Let timeMid be the 4 character hexadecimal representation + of array[2], left padding the string with + "0" until 4 characters are reached. +

    +
  8. +
  9. +

    + Let timeHighAndVersion be a 4 character hexidecimal string + populated as follows: +

    +
      +
    • +

      + Set the 4 most significant bits of array[3] + to 0b0100. +

      +
    • +

      + Set timeHighAndVersion equal to the 4 character hexadecimal representation + of array[3], left padding the string with + "0" until 4 characters are reached. +

      +
    +
  10. +
  11. +

    + Let clockSeqAndReservedClockSeqLow be a 4 character hexidecimal string + populated as follows: +

    +
      +
    • +

      + Set the 2 most significant bits of array[4] + to 0b01. +

      +
    • +
    • +

      + Set clockSeqAndReservedClockSeqLow equal to the 4 character hexadecimal representation + of array[4], left padding the string with + "0" until 4 characters are reached. +

      +
    • +
    +
  12. +
  13. +

    + Let node be an 12 character hexadecimal string + populated as follows: +

    +
      +
    • +

      + Let c be the 4 character hexadecimal representation + of array[5], left padding the string with + "0" until 4 characters are reached. +

      +
    • +
    • +

      + Let d be the 4 character hexadecimal representation + of array[6], left padding the string with + "0" until 4 characters are reached. +

      +
    • +
    • +

      + Let e be the 4 character hexadecimal representation + of array[7], left padding the string with + "0" until 4 characters are reached. +

      +
    • +
    • +

      + Set node to the string created by appending + c to d to e (left to right). +

      +
    • +
    +
  14. +
  15. +

    + Return the DOMString + created by appending timeLow to timeMid to + timeHighAndVersion to clockSeqAndReservedClockSeqLow + to node (left to right) separating each hexadecimal string by + "-". +

    +
  16. +
+
From fd5a302eb97fd9c302bbf7ed9072dc0223c085bc Mon Sep 17 00:00:00 2001 From: bcoe Date: Sun, 24 Jan 2021 15:09:18 -0800 Subject: [PATCH 02/12] chore: address code review, convert to 8 bit --- index.html | 126 ++++++++++++++++++----------------------------------- 1 file changed, 43 insertions(+), 83 deletions(-) diff --git a/index.html b/index.html index dcc7bae..9dd446d 100644 --- a/index.html +++ b/index.html @@ -105,135 +105,95 @@

The randomUUID
  1. - Let array be a new Uint16Array with 8 elements. + Let array be a list with 16 elements of the type byte.

  2. Overwrite all elements of array with cryptographically random values of - a 16-bit unsigned integer type. + the type byte.

  3. - Let timeLow be an 8 character hexadecimal string - populated as follows: -

    -
      -
    • -

      - Let a be the 4 character hexadecimal representation - of array[0], left padding the string with - "0" until 4 characters are reached. -

      -
    • -
    • -

      - Let b be the 4 character hexadecimal representation - of array[1], left padding the string with - "0" until 4 characters are reached. -

      -
    • -
    • -

      - Set timeLow equal to a appended to - b (left to right). -

      -
    • -
    -
  4. -
  5. -

    - Let timeMid be the 4 character hexadecimal representation - of array[2], left padding the string with - "0" until 4 characters are reached. + Let timeLow be the concatenation + of the hexadecimal representation of « array[0], + array[1], array[2], array[3] ».

  6. - Let timeHighAndVersion be a 4 character hexidecimal string - populated as follows: + Let timeMid be the concatenation + of the hexadecimal representation of « array[4], + array[5] ».

    -
      -
    • -

      - Set the 4 most significant bits of array[3] - to 0b0100. -

      -
    • -

      - Set timeHighAndVersion equal to the 4 character hexadecimal representation - of array[3], left padding the string with - "0" until 4 characters are reached. -

      -
  7. - Let clockSeqAndReservedClockSeqLow be a 4 character hexidecimal string + Let timeHighAndVersion be a 4 character string populated as follows:

    -
      +
      1. - Set the 2 most significant bits of array[4] - to 0b01. + Set the 4 most significant bits of array[6] + to the 0b0100 version.

      2. - Set clockSeqAndReservedClockSeqLow equal to the 4 character hexadecimal representation - of array[4], left padding the string with - "0" until 4 characters are reached. + Set timeHighAndVersion be the concatenation + of the hexadecimal representation of « array[6], + array[7] ».

      3. -
    +
  • - Let node be an 12 character hexadecimal string + Let clockSeqAndReservedClockSeqLow be a 4 character string populated as follows:

    -
      -
    • -

      - Let c be the 4 character hexadecimal representation - of array[5], left padding the string with - "0" until 4 characters are reached. -

      -
    • +
      1. - Let d be the 4 character hexadecimal representation - of array[6], left padding the string with - "0" until 4 characters are reached. + Set the 2 most significant bits of array[8] + to the 0b10 variant.

      2. - Let e be the 4 character hexadecimal representation - of array[7], left padding the string with - "0" until 4 characters are reached. + Set clockSeqAndReservedClockSeqLow be the concatenation + of the hexadecimal representation of « array[8], + array[9] ».

      3. -
      4. -

        - Set node to the string created by appending - c to d to e (left to right). -

        -
      5. -
    + +
  • +
  • +

    + Let node be the concatenation + of the hexadecimal representation of « array[10], + array[11], array[12], array[13], + array[14], array[15]». +

  • - Return the DOMString - created by appending timeLow to timeMid to - timeHighAndVersion to clockSeqAndReservedClockSeqLow - to node (left to right) separating each hexadecimal string by - "-". + Return the concatenation of + « timeLow, timeMid, timeHighAndVersion + clockSeqAndReservedClockSeqLow, node » with separator "-".

  • +

    + For the steps described in the randomUUID() algorithm, + the hexadecimal representation + of a byte value is the + two-character string created by expressing value in hexadecimal + using ASCII lower hex digit, + left-padded with "0" to reach two characters. +

    From 9bf97549707e9cb238aae43d886f79b1eb1f4bd9 Mon Sep 17 00:00:00 2001 From: bcoe Date: Sun, 24 Jan 2021 15:50:53 -0800 Subject: [PATCH 03/12] docs: add note about NSS --- index.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.html b/index.html index 9dd446d..a31a7c3 100644 --- a/index.html +++ b/index.html @@ -97,6 +97,11 @@

    Extensions to the Crypto interface

    DOMString randomUUID(); }; +

    Note: + randomUUID() returns the + namespace specific string representation of a UUID described in + RFC4122. +

    The randomUUID() method.

    The From 7eb06cbd70edb05341d44006f37d899b771f6aaf Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 25 Jan 2021 07:57:41 -0800 Subject: [PATCH 04/12] Update index.html Co-authored-by: Christoph Tavan --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index a31a7c3..0b030b6 100644 --- a/index.html +++ b/index.html @@ -115,7 +115,7 @@

    The randomUUID
  • - Overwrite all elements of array with cryptographically random values of + Overwrite all elements of array with cryptographically secure random values of the type byte.

  • From fdd992c6fa03519b0941cb6371e92e01d94f4ee2 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 25 Jan 2021 07:58:01 -0800 Subject: [PATCH 05/12] Update index.html Co-authored-by: Christoph Tavan --- index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 0b030b6..55c07db 100644 --- a/index.html +++ b/index.html @@ -98,7 +98,9 @@

    Extensions to the Crypto interface

    };

    Note: - randomUUID() returns the + randomUUID() generates a new + version 4 UUID and returns its + namespace specific string representation described in namespace specific string representation of a UUID described in RFC4122. From 0269843eea6c93fb9021cb77775908fccbda71a3 Mon Sep 17 00:00:00 2001 From: bcoe Date: Tue, 26 Jan 2021 18:59:27 -0800 Subject: [PATCH 06/12] review: move hexadecimal representation to inside list --- index.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 55c07db..970239f 100644 --- a/index.html +++ b/index.html @@ -124,15 +124,15 @@

    The randomUUID
  • Let timeLow be the concatenation - of the hexadecimal representation of « array[0], - array[1], array[2], array[3] ». + of « hexadecimal representation of array[0], + hexadecimal representation of array[1], hexadecimal representation of array[2], hexadecimal representation of array[3] ».

  • Let timeMid be the concatenation - of the hexadecimal representation of « array[4], - array[5] ». + of « hexadecimal representation of array[4], + hexadecimal representation of array[5] ».

  • @@ -150,8 +150,8 @@

    The randomUUID
  • Set timeHighAndVersion be the concatenation - of the hexadecimal representation of « array[6], - array[7] ». + of « hexadecimal representation of array[6], + hexadecimal representation of array[7] ».

  • @@ -171,8 +171,8 @@

    The randomUUID
  • Set clockSeqAndReservedClockSeqLow be the concatenation - of the hexadecimal representation of « array[8], - array[9] ». + of « hexadecimal representation array[8], + hexadecimal representation array[9] ».

  • @@ -180,9 +180,9 @@

    The randomUUID
  • Let node be the concatenation - of the hexadecimal representation of « array[10], - array[11], array[12], array[13], - array[14], array[15]». + of « hexadecimal representation array[10], + hexadecimal representation array[11], hexadecimal representation array[12], hexadecimal representation array[13], + hexadecimal representation array[14], hexadecimal representation array[15] ».

  • From ac83a599b2fffa6db59b523403fd03a31fbac8f2 Mon Sep 17 00:00:00 2001 From: bcoe Date: Tue, 26 Jan 2021 19:05:56 -0800 Subject: [PATCH 07/12] review: use data-cite rather than typedef --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 970239f..d04777a 100644 --- a/index.html +++ b/index.html @@ -112,13 +112,13 @@

    The randomUUID
    1. - Let array be a list with 16 elements of the type byte. + Let array be a list with 16 elements of the type byte.

    2. Overwrite all elements of array with cryptographically secure random values of - the type byte. + the type byte.

    3. @@ -196,7 +196,7 @@

      The randomUUID

      For the steps described in the randomUUID() algorithm, the hexadecimal representation - of a byte value is the + of a byte value is the two-character string created by expressing value in hexadecimal using ASCII lower hex digit, left-padded with "0" to reach two characters. From 8aa671ff6fcde2a7b922aa606d5294a1eaebfc80 Mon Sep 17 00:00:00 2001 From: bcoe Date: Tue, 26 Jan 2021 19:11:54 -0800 Subject: [PATCH 08/12] review: remove code blocks from array variables --- index.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index d04777a..83bc1b3 100644 --- a/index.html +++ b/index.html @@ -124,15 +124,15 @@

      The randomUUID
    4. Let timeLow be the concatenation - of « hexadecimal representation of array[0], - hexadecimal representation of array[1], hexadecimal representation of array[2], hexadecimal representation of array[3] ». + of « hexadecimal representation of array[0], + hexadecimal representation of array[1], hexadecimal representation of array[2], hexadecimal representation of array[3] ».

    5. Let timeMid be the concatenation - of « hexadecimal representation of array[4], - hexadecimal representation of array[5] ». + of « hexadecimal representation of array[4], + hexadecimal representation of array[5] ».

    6. @@ -143,15 +143,15 @@

      The randomUUID
      1. - Set the 4 most significant bits of array[6] + Set the 4 most significant bits of array[6] to the 0b0100 version.

      2. Set timeHighAndVersion be the concatenation - of « hexadecimal representation of array[6], - hexadecimal representation of array[7] ». + of « hexadecimal representation of array[6], + hexadecimal representation of array[7] ».

      @@ -164,15 +164,15 @@

      The randomUUID
      1. - Set the 2 most significant bits of array[8] + Set the 2 most significant bits of array[8] to the 0b10 variant.

      2. Set clockSeqAndReservedClockSeqLow be the concatenation - of « hexadecimal representation array[8], - hexadecimal representation array[9] ». + of « hexadecimal representation array[8], + hexadecimal representation array[9] ».

      @@ -180,9 +180,9 @@

      The randomUUID
    7. Let node be the concatenation - of « hexadecimal representation array[10], - hexadecimal representation array[11], hexadecimal representation array[12], hexadecimal representation array[13], - hexadecimal representation array[14], hexadecimal representation array[15] ». + of « hexadecimal representation array[10], + hexadecimal representation array[11], hexadecimal representation array[12], hexadecimal representation array[13], + hexadecimal representation array[14], hexadecimal representation array[15] ».

    8. From bdaad7b10fd9f910f16b81a512f749f2a22d3c3e Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Tue, 26 Jan 2021 19:12:39 -0800 Subject: [PATCH 09/12] Update index.html Co-authored-by: Domenic Denicola --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 83bc1b3..c4d9d5a 100644 --- a/index.html +++ b/index.html @@ -188,7 +188,7 @@

      The randomUUID
    9. Return the concatenation of - « timeLow, timeMid, timeHighAndVersion + « timeLow, timeMid, timeHighAndVersion, clockSeqAndReservedClockSeqLow, node » with separator "-".

    10. From 855ea79dc8a156a9833d53ac278cd937ffdca4d6 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Tue, 26 Jan 2021 19:12:58 -0800 Subject: [PATCH 10/12] Update index.html Co-authored-by: Domenic Denicola --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index c4d9d5a..00a7664 100644 --- a/index.html +++ b/index.html @@ -194,7 +194,7 @@

      The randomUUID

    - For the steps described in the randomUUID() algorithm, + For the steps described in the randomUUID() algorithm, the hexadecimal representation of a byte value is the two-character string created by expressing value in hexadecimal From b3bea1b76e2b9ad0e81d73b08beb941db0faeb56 Mon Sep 17 00:00:00 2001 From: bcoe Date: Fri, 29 Jan 2021 16:21:03 -0800 Subject: [PATCH 11/12] chore: address code review --- index.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 00a7664..41a99ea 100644 --- a/index.html +++ b/index.html @@ -143,8 +143,7 @@

    The randomUUID
    1. - Set the 4 most significant bits of array[6] - to the 0b0100 version. + Set the 4 most significant bits of array[6], which represent the UUID version, to 0b0100.

    2. @@ -198,7 +197,7 @@

      The randomUUID the hexadecimal representation of a byte value is the two-character string created by expressing value in hexadecimal - using ASCII lower hex digit, + using ASCII lower hex digits, left-padded with "0" to reach two characters.

  • From aaf7205297ff1658c2a7285027148e39ac8a2c62 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Wed, 3 Feb 2021 17:17:57 -0800 Subject: [PATCH 12/12] Update index.html Co-authored-by: Domenic Denicola --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 41a99ea..32be7ea 100644 --- a/index.html +++ b/index.html @@ -98,7 +98,7 @@

    Extensions to the Crypto interface

    };

    Note: - randomUUID() generates a new + randomUUID() generates a new version 4 UUID and returns its namespace specific string representation described in namespace specific string representation of a UUID described in