XstarS.GuidModule
1.11.2
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package XstarS.GuidModule --version 1.11.2
NuGet\Install-Package XstarS.GuidModule -Version 1.11.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XstarS.GuidModule" Version="1.11.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XstarS.GuidModule --version 1.11.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XstarS.GuidModule, 1.11.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install XstarS.GuidModule as a Cake Addin #addin nuget:?package=XstarS.GuidModule&version=1.11.2 // Install XstarS.GuidModule as a Cake Tool #tool nuget:?package=XstarS.GuidModule&version=1.11.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
F# GUID Module
Provides RFC 4122 UUID compliant GUID operations for F#. The orders of input parameters are adjusted to match F# pipeline patterns.
RFC 4122 UUID Standard
RFC 4122 defines the following five versions of UUID:
- Version 1: The time-based version, contains a 60-bit timestamp and a 12-bit MAC address
- Version 2: DCE Security version, contains a 28-bit timestamp, a 12-bit MAC address and a 32-bit local ID
- Version 3: The name-based version, using MD5 hashing to compute the hash of the namespace and name
- Version 4: The randomly or pseudo-randomly generated version, equivalent to
Guid.NewGuid()
in .NET - Version 5: The name-based version, using SHA-1 hashing to compute the hash of the namespace and name
There is also a special Nil UUID whose bytes are all 0x00
s, which is equivalent to Guid.Empty
in .NET.
F# GUID Module Usage
Core module: XNetEx.FSharp.Core.Guid
.
RFC 4122 GUID Generation
open System
open XNetEx.FSharp.Core
// load generator state from file.
let loadResult = Guid.loadState "state.bin"
// generate time-based GUID.
let guidV1 = Guid.newV1 () // 3944a871-aa14-11ed-8791-a9a9a46de54f
// generate randomized GUID.
let guidV4 = Guid.newV4 () // 0658f02d-45a4-4c25-b9d0-8ddbda3c3e08
// generate name-based GUID.
let guidV3 = Guid.newV3S Guid.nsDns "github.com"
// 7f4771a0-1982-373d-928f-d31140a51652
let guidV5 = "github.com" |> Guid.newV5S Guid.nsDns
// 6fca3dd2-d61d-58de-9363-1574b382ea68
// build time-based GUID.
let guid6 = Guid.empty
|> Guid.replaceVariant Guid.Variant.Rfc4122
|> Guid.replaceVersion Guid.Version.Version1
|> Guid.replaceTime DateTime.UtcNow
|> Guid.replaceClockSeq 0x0123s
|> Guid.replaceNodeId (Array.init 6 (((+) 1) >> byte))
// 8dec2054-aa17-11ed-8123-010203040506
Common GUID Operations
open XNetEx.FSharp.Core
// GUID parsing and formatting.
let guid1 = Guid.parse "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
let guid2 = "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}"
|> Guid.parseExact "B"
printfn "%s" (guid2 |> Guid.format "X")
// GUID construction and deconstruction.
let guid3 = Guid.ofFields
0x00112233 0x4455s 0x6677s (0x88uy, 0x99uy)
(0xAAuy, 0xBBuy, 0xCCuy, 0xDDuy, 0xEEuy, 0xFFuy)
let guid3Fields = guid3 |> Guid.toFields
let guid4 = Array.map byte
[| 0x00; 0x11; 0x22; 0x33; 0x44; 0x55; 0x66; 0x77
0x88; 0x99; 0xAA; 0xBB; 0xCC; 0xDD; 0xEE; 0xFF |]
|> Guid.ofBytesUuid
let guid4Bytes = Guid.toBytes guid4
assert (guid3 = guid4)
let guid5 = Array.map byte
[| 0x33; 0x22; 0x11; 0x00; 0x55; 0x44; 0x77; 0x66
0x88; 0x99; 0xAA; 0xBB; 0xCC; 0xDD; 0xEE; 0xFF |]
|> Guid.ofBytes
let guid5Bytes = Guid.toBytesUuid guid5
assert (guid3 = guid5)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- FSharp.Core (>= 6.0.0)
- XstarS.GuidGenerators (>= 1.11.2)
-
.NETStandard 2.1
- FSharp.Core (>= 6.0.0)
- XstarS.GuidGenerators (>= 1.11.2)
-
net8.0
- FSharp.Core (>= 6.0.0)
- XstarS.GuidGenerators (>= 1.11.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
2.5.0 | 74 | 12/4/2024 | |
2.4.3 | 89 | 11/13/2024 | |
2.4.2 | 109 | 11/9/2024 | |
2.4.1 | 95 | 10/10/2024 | |
2.4.0 | 125 | 5/12/2024 | |
2.4.0-preview | 114 | 4/20/2024 | |
2.3.1 | 120 | 3/24/2024 | |
2.3.0 | 125 | 2/24/2024 | |
2.2.1 | 142 | 2/8/2024 | |
2.2.0 | 104 | 1/26/2024 | |
2.1.2 | 120 | 1/22/2024 | |
2.1.1 | 126 | 1/20/2024 | |
2.1.0 | 134 | 1/12/2024 | |
2.0.0 | 153 | 12/24/2023 | |
2.0.0-rc-19 | 138 | 12/22/2023 | |
2.0.0-rc-16 | 114 | 12/12/2023 | |
2.0.0-rc-15 | 134 | 12/6/2023 | |
2.0.0-rc-14 | 132 | 11/26/2023 | |
2.0.0-rc-12.5 | 102 | 10/15/2023 | |
2.0.0-rc-12 | 89 | 10/15/2023 | |
2.0.0-rc-00 | 133 | 7/15/2023 | |
2.0.0-preview-04.5 | 92 | 6/4/2023 | |
2.0.0-preview-04 | 114 | 5/28/2023 | |
2.0.0-preview-03.8 | 81 | 5/20/2023 | |
2.0.0-preview-03.5 | 83 | 5/14/2023 | |
2.0.0-preview-03 | 126 | 4/15/2023 | |
2.0.0-preview-02.5 | 105 | 3/26/2023 | |
2.0.0-preview-02 | 148 | 3/4/2023 | |
2.0.0-preview-01 | 141 | 2/12/2023 | |
1.15.0 | 76 | 12/4/2024 | |
1.14.3 | 81 | 11/13/2024 | |
1.14.2 | 82 | 11/9/2024 | |
1.14.1 | 84 | 10/10/2024 | |
1.14.0 | 109 | 5/12/2024 | |
1.14.0-preview | 108 | 4/20/2024 | |
1.13.0 | 122 | 2/24/2024 | |
1.12.1 | 129 | 2/8/2024 | |
1.12.0 | 100 | 1/26/2024 | |
1.11.2 | 118 | 1/22/2024 | |
1.11.1 | 115 | 1/20/2024 | |
1.11.0 | 119 | 1/12/2024 | |
1.10.0 | 128 | 12/24/2023 | |
1.9.5 | 146 | 12/22/2023 | |
1.9.1 | 132 | 12/12/2023 | |
1.9.0 | 166 | 12/6/2023 | |
1.8.0 | 152 | 11/26/2023 | |
1.7.8 | 139 | 10/15/2023 | |
1.7.5 | 162 | 6/4/2023 | |
1.7.1 | 143 | 5/28/2023 | |
1.7.0 | 146 | 5/20/2023 | |
1.6.0 | 159 | 5/13/2023 | |
1.5.0 | 288 | 2/5/2023 | |
1.4.0 | 301 | 1/21/2023 | |
1.3.1 | 299 | 1/15/2023 | |
1.3.0 | 291 | 12/31/2022 | |
1.2.0 | 414 | 9/30/2022 | |
1.1.1 | 419 | 8/5/2022 | |
1.1.0 | 400 | 7/25/2022 |