UuidByString 2.0.0
See the version list below for details.
dotnet add package UuidByString --version 2.0.0
NuGet\Install-Package UuidByString -Version 2.0.0
<PackageReference Include="UuidByString" Version="2.0.0" />
<PackageVersion Include="UuidByString" Version="2.0.0" />
<PackageReference Include="UuidByString" />
paket add UuidByString --version 2.0.0
#r "nuget: UuidByString, 2.0.0"
#:package UuidByString@2.0.0
#addin nuget:?package=UuidByString&version=2.0.0
#tool nuget:?package=UuidByString&version=2.0.0
UuidByString
A .NET library for generating deterministic RFC-4122 Name-Based UUIDs from strings using MD5 (v3) or SHA1 (v5) hashing algorithms.
Note: This project is a port of the uuid-by-string npm package for .NET.
Installation
Install via .NET CLI:
dotnet add package UuidByString
Supported Frameworks
- .NET Framework 4.0
- .NET Framework 4.8
- .NET 9.0
Usage
The package provides static methods to generate UUIDs. The method receives any string and returns a generated hash.
Regular Using
using UuidByString;
string uuid = UuidGenerator.GenerateUuid("Hello world!");
// d3486ae9-136e-5856-bc42-212385ea7970
Static Using
using static UuidByString.UuidGenerator;
string uuid = GenerateUuid("Hello world!");
// d3486ae9-136e-5856-bc42-212385ea7970
The string "Hello world!" will always return d3486ae9-136e-5856-bc42-212385ea7970.
Specify UUID Version
You can specify the UUID version. Available versions are 3 and 5 according to RFC-4122. The version determines the hashing algorithm: version 3 uses MD5, and version 5 uses SHA-1. SHA-1 is used by default if version is not specified.
// Version 3 (MD5)
string uuidV3 = UuidGenerator.GenerateUuid("Hello world!", 3);
// 86fb269d-190d-3c85-b6e0-468ceca42a20
// Version 5 (SHA-1) - explicit
string uuidV5 = UuidGenerator.GenerateUuid("Hello world!", 5);
// d3486ae9-136e-5856-bc42-212385ea7970
Using Namespaces
// With namespace
string uuid = UuidGenerator.GenerateUuid("Hello world!", "my-namespace");
// With namespace and version
string uuid = UuidGenerator.GenerateUuid("Hello world!", "my-namespace", 3);
API
Methods
GenerateUuid(string target)- Generates UUID with default version 5 (SHA-1)GenerateUuid(string target, int version)- Generates UUID with specified version (3 or 5)GenerateUuid(string target, string namespace)- Generates UUID with namespace and default version 5GenerateUuid(string target, string namespace, int version)- Generates UUID with namespace and specified version
Parameters
target- The string to generate UUID fromnamespace(optional) - UUID namespaceversion(optional) - 3 for MD5, 5 for SHA-1 (default: 5)
License
MIT License - Copyright (c) 2025 Benny Shtemer
Repository
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
BREAKING CHANGE: Renamed UuidByString class to UuidGenerator