UuidByString 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package UuidByString --version 2.0.0
                    
NuGet\Install-Package UuidByString -Version 2.0.0
                    
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="UuidByString" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UuidByString" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="UuidByString" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add UuidByString --version 2.0.0
                    
#r "nuget: UuidByString, 2.0.0"
                    
#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.
#:package UuidByString@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=UuidByString&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=UuidByString&version=2.0.0
                    
Install as a Cake Tool

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 5
  • GenerateUuid(string target, string namespace, int version) - Generates UUID with namespace and specified version

Parameters

  • target - The string to generate UUID from
  • namespace (optional) - UUID namespace
  • version (optional) - 3 for MD5, 5 for SHA-1 (default: 5)

License

MIT License - Copyright (c) 2025 Benny Shtemer

Repository

https://github.com/benny779/UuidByString

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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.

Version Downloads Last Updated
2.0.1 107 1/28/2026
2.0.0 98 1/28/2026
1.1.0 288 12/16/2025
1.0.0 282 12/16/2025

BREAKING CHANGE: Renamed UuidByString class to UuidGenerator