Skip to content

Commit 106e3d4

Browse files
authored
adding legal notifce from rfc9562
Signed-off-by: GitHub <[email protected]>
1 parent b6e6c07 commit 106e3d4

File tree

9 files changed

+120
-7
lines changed

9 files changed

+120
-7
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/universal:2"
3+
}

LICENSE.rfc9562.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.
2+
3+
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.

Library/DaanV2.UUID.Net.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Complies with the RFC 4122 / RFC 9562 standard. And has version 1-8 UUIDs implem
2424
<RepositoryUrl>https://github.com/DaanV2/DaanV2.UUID.Net</RepositoryUrl>
2525
<RepositoryType>git</RepositoryType>
2626
<PackageTags>UUID;RFC-4122;V1;V3;V4;V5;V6;V7;V8</PackageTags>
27-
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
27+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
28+
<PackageLicenseFile>LICENSE.rfc9562.txt</PackageLicenseFile>
2829
<IncludeSymbols>True</IncludeSymbols>
2930
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
3031
</PropertyGroup>
@@ -59,6 +60,10 @@ Complies with the RFC 4122 / RFC 9562 standard. And has version 1-8 UUIDs implem
5960
<PackagePath>\</PackagePath>
6061
</None>
6162
<None Include="..\README.md">
63+
<None Include="..\LICENSE.rfc9562.txt">
64+
<Pack>True</Pack>
65+
<PackagePath>\</PackagePath>
66+
</None>
6267
<Pack>True</Pack>
6368
<PackagePath>\</PackagePath>
6469
</None>

Library/Static Classes/V6/V6.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
using System.Net.NetworkInformation;
1+

2+
// Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.
3+
//
4+
// This code is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of RFC 9562.
5+
// Code Components extracted from RFC 9562 must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.
6+
//
7+
// This code was derived from IETF RFC 9562. Please reproduce this note if possible.
8+
using System.Net.NetworkInformation;
29

310
namespace DaanV2.UUID;
411

Library/Static Classes/V7/V7.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
using System;
1+
// Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.
2+
//
3+
// This code is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of RFC 9562.
4+
// Code Components extracted from RFC 9562 must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.
5+
//
6+
// This code was derived from IETF RFC 9562. Please reproduce this note if possible.
7+
using System;
28
using System.Collections.Generic;
39
using System.Linq;
410
using System.Text;

Library/Static Classes/V8/V8.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
using System;
1+
// Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.
2+
//
3+
// This code is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of RFC 9562.
4+
// Code Components extracted from RFC 9562 must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.
5+
//
6+
// This code was derived from IETF RFC 9562. Please reproduce this note if possible.
7+
using System;
28
using System.Collections.Generic;
39
using System.Linq;
410
using System.Text;

Tests/Generation/V2Tests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ public sealed partial class V2Tests {
55
[Fact(DisplayName = "When generating with specific time returns expected result")]
66
public void TestSpecific1() {
77
var dateTime = new DateTime(2019, 1, 2, 3, 4, 5, DateTimeKind.Utc);
8-
UUID uuid = V2.Generate(dateTime, 0, V1.GetMacAddressBytes());
8+
UUID uuid = V2.Generate(dateTime, 0, V2.GetMacAddressBytes());
99

1010
Utility.ValidateUUID(uuid, V2.Version, V2.Variant);
11-
Byte[] macAddress = V1.GetMacAddressBytes();
11+
Byte[] macAddress = V2.GetMacAddressBytes();
1212
String machex = BitConverter.ToString(macAddress).Replace("-", String.Empty).ToLower();
1313

1414
String str = uuid.ToString();
@@ -20,7 +20,7 @@ public void TestSpecific1() {
2020
V2.Information data = V2.Extract(uuid);
2121
Assert.Equal(dateTime, data.Timestamp);
2222
Assert.Equal(0u, data.LocalIdentifier);
23-
Assert.Equal(V1.GetMacAddressBytes(), data.MacAddress);
23+
Assert.Equal(V2.GetMacAddressBytes(), data.MacAddress);
2424
}
2525

2626
[Theory(DisplayName = "When batch generating, will always return unique UUIDs")]

Tests/RFC/RFC4122.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using DaanV2.UUID;
2+
3+
namespace Tests.RFC;
4+
5+
public sealed partial class RFC4122Tests {
6+
7+
[Fact(DisplayName = "RFC4122 Appendix B v3 (MD5, DNS, www.example.com)")]
8+
public void RFC4122_AppendixB_V3_MD5_DNS_ExampleCom() {
9+
// Per RFC4122 Appendix B, corrected by EID 3476
10+
var uuid = new UUID("5df41881-3aed-3515-88a7-2f4a814cf09e");
11+
Assert.Equal("5df41881-3aed-3515-88a7-2f4a814cf09e", uuid.ToString().ToLower());
12+
Utility.ValidateUUID(uuid, V3.Version, V3.Variant);
13+
}
14+
15+
}

Tests/RFC/RFC9562.cs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.
2+
//
3+
// This code is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of RFC 9562.
4+
// Code Components extracted from RFC 9562 must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.
5+
//
6+
// This code was derived from IETF RFC 9562. Please reproduce this note if possible.
7+
8+
using DaanV2.UUID;
9+
10+
namespace Tests.RFC;
11+
12+
public sealed partial class RFC9562Tests {
13+
[Fact(DisplayName = "UUIDv1 RFC test vector")]
14+
public void UUIDv1_RFC_TestVector() {
15+
var uuid = new UUID("C232AB00-9414-11EC-B3C8-9F6BDECED846");
16+
Assert.Equal("c232ab00-9414-11ec-b3c8-9f6bdeced846", uuid.ToString().ToLower());
17+
Utility.ValidateUUID(uuid, V1.Version, V1.Variant);
18+
}
19+
20+
[Fact(DisplayName = "UUIDv3 RFC test vector")]
21+
public void UUIDv3_RFC_TestVector() {
22+
var uuid = new UUID("5df41881-3aed-3515-88a7-2f4a814cf09e");
23+
Assert.Equal("5df41881-3aed-3515-88a7-2f4a814cf09e", uuid.ToString().ToLower());
24+
Utility.ValidateUUID(uuid, V3.Version, V3.Variant);
25+
}
26+
27+
[Fact(DisplayName = "UUIDv4 RFC test vector")]
28+
public void UUIDv4_RFC_TestVector() {
29+
var uuid = new UUID("919108f7-52d1-4320-9bac-f847db4148a8");
30+
Assert.Equal("919108f7-52d1-4320-9bac-f847db4148a8", uuid.ToString().ToLower());
31+
Utility.ValidateUUID(uuid, V4.Version, V4.Variant);
32+
}
33+
34+
[Fact(DisplayName = "UUIDv5 RFC test vector")]
35+
public void UUIDv5_RFC_TestVector() {
36+
var uuid = new UUID("2ed6657d-e927-568b-95e1-2665a8aea6a2");
37+
Assert.Equal("2ed6657d-e927-568b-95e1-2665a8aea6a2", uuid.ToString().ToLower());
38+
Utility.ValidateUUID(uuid, V5.Version, V5.Variant);
39+
}
40+
41+
[Fact(DisplayName = "UUIDv6 RFC test vector")]
42+
public void UUIDv6_RFC_TestVector() {
43+
var uuid = new UUID("1ec9414c-232a-6b00-b3c8-9f6bdeced846");
44+
Assert.Equal("1ec9414c-232a-6b00-b3c8-9f6bdeced846", uuid.ToString().ToLower());
45+
Utility.ValidateUUID(uuid, V6.Version, V6.Variant);
46+
}
47+
48+
[Fact(DisplayName = "UUIDv7 RFC test vector")]
49+
public void UUIDv7_RFC_TestVector() {
50+
var uuid = new UUID("017f22e2-79b0-7cc3-98c4-dc0c0c07398f");
51+
Assert.Equal("017f22e2-79b0-7cc3-98c4-dc0c0c07398f", uuid.ToString().ToLower());
52+
Utility.ValidateUUID(uuid, V7.Version, V7.Variant);
53+
}
54+
55+
[Fact(DisplayName = "UUIDv8 RFC test vector (time-based)")]
56+
public void UUIDv8_RFC_TestVector_TimeBased() {
57+
var uuid = new UUID("2489e9ad-2ee2-8e00-8ec9-32d5f69181c0");
58+
Assert.Equal("2489e9ad-2ee2-8e00-8ec9-32d5f69181c0", uuid.ToString().ToLower());
59+
Utility.ValidateUUID(uuid, V8.Version, V8.Variant);
60+
}
61+
62+
[Fact(DisplayName = "UUIDv8 RFC test vector (name-based SHA-256)")]
63+
public void UUIDv8_RFC_TestVector_NameBased() {
64+
var uuid = new UUID("5c146b14-3c52-8afd-938a-375d0df1fbf6");
65+
Assert.Equal("5c146b14-3c52-8afd-938a-375d0df1fbf6", uuid.ToString().ToLower());
66+
Utility.ValidateUUID(uuid, V8.Version, V8.Variant);
67+
}
68+
}

0 commit comments

Comments
 (0)