Soenneker.Utils.Password 11.0.1332

Prefix Reserved
dotnet add package Soenneker.Utils.Password --version 11.0.1332
                    
NuGet\Install-Package Soenneker.Utils.Password -Version 11.0.1332
                    
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="Soenneker.Utils.Password" Version="11.0.1332" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.Password" Version="11.0.1332" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Utils.Password" />
                    
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 Soenneker.Utils.Password --version 11.0.1332
                    
#r "nuget: Soenneker.Utils.Password, 11.0.1332"
                    
#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 Soenneker.Utils.Password@11.0.1332
                    
#: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=Soenneker.Utils.Password&version=11.0.1332
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.Password&version=11.0.1332
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Utils.Password

A modern .NET secure password generator.

Installation

dotnet add package Soenneker.Utils.Password

Quick start

using Soenneker.Utils.Password;

Call the static PasswordUtil methods directly; no dependency-injection registration is required.

Fill a caller-owned buffer

using System.Runtime.InteropServices;
using System.Security.Cryptography;

Span<char> password = stackalloc char[32];

try
{
    PasswordUtil.GetPassword(
        password,
        includeLowers: true,
        includeUppers: true,
        includeNumbers: true,
        includeSpecials: true,
        excludeAmbiguous: true);

    UsePassword(password);
}
finally
{
    CryptographicOperations.ZeroMemory(MemoryMarshal.AsBytes(password));
}

GetPassword fills the entire destination, guarantees at least one character from every enabled class, fills the remainder from the combined alphabet, and securely shuffles the result. The destination must be at least as long as the number of enabled classes. At least one class must be enabled.

The special-character alphabet is !@#$%^*()[]{},.:~_-=. Ambiguous filtering applies to the letter and number alphabets; it does not modify the special alphabet.

URI-safe passwords

Span<char> token = stackalloc char[24];
PasswordUtil.GetUriSafePassword(token, excludeAmbiguous: true);

try
{
    UseToken(token);
}
finally
{
    CryptographicOperations.ZeroMemory(MemoryMarshal.AsBytes(token));
}

The URI-safe methods use only ASCII lowercase letters, uppercase letters, and digits. They do not perform URL encoding and do not include punctuation.

String convenience methods

string password = PasswordUtil.GetPasswordString(length: 32);
string token = PasswordUtil.GetUriSafePasswordString(length: 24);
string digits = PasswordUtil.GetSecureCharacters(8, "0123456789");

GetSecureCharacters samples uniformly from the supplied alphabet without modulo bias, but it does not guarantee every character or category appears. Its overload accepting a RandomNumberGenerator leaves that caller-owned generator open.

The string-returning methods are convenient, but managed strings cannot be reliably cleared from memory. Prefer the span overloads for secrets whose lifetime you need to limit, and securely clear the buffer in a finally block. Clearing the caller's buffer cannot erase copies already made by logging, interpolation, encoding, or another API.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
11.0.1332 339 11/11/2026
11.0.1331 82 11/11/2026
11.0.1330 99 11/11/2026
11.0.1329 91 11/11/2026
11.0.1327 1,076 10/27/2026
11.0.1325 146 10/26/2026
11.0.1324 130 10/26/2026
11.0.1323 109 10/26/2026
4.0.1322 608 10/15/2026
4.0.1321 107 10/14/2026
4.0.1320 108 10/14/2026
4.0.1319 108 10/14/2026
4.0.1318 104 10/14/2026
4.0.1316 102 10/14/2026
4.0.1310 102 10/13/2026
4.0.1309 105 10/13/2026
4.0.1306 125 10/12/2026
4.0.1305 108 10/11/2026
4.0.1303 112 10/11/2026
4.0.1302 397 9/25/2026
Loading failed

Updated Multiple NuGet packages