Simple.PasswordGenerator 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Simple.PasswordGenerator --version 1.0.3
                    
NuGet\Install-Package Simple.PasswordGenerator -Version 1.0.3
                    
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="Simple.PasswordGenerator" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Simple.PasswordGenerator" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Simple.PasswordGenerator" />
                    
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 Simple.PasswordGenerator --version 1.0.3
                    
#r "nuget: Simple.PasswordGenerator, 1.0.3"
                    
#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 Simple.PasswordGenerator@1.0.3
                    
#: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=Simple.PasswordGenerator&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Simple.PasswordGenerator&version=1.0.3
                    
Install as a Cake Tool

Simple.PasswordGenerator

GitHub Repo stars
GitHub Actions Workflow Status
NuGet version
NuGet Downloads
GitHub Issues


πŸš€ Overview

Simple.PasswordGenerator is a lightweight, secure password generator for .NET applications.
It creates cryptographically strong passwords based on customizable policies β€” including length, required character types, and special characters.

No dependencies beyond .NET. Simple to integrate, flexible to configure, and safe to use.


πŸ”‘ Key Features

  • πŸ” Cryptographically secure password generation
  • βš™οΈ Fully customizable policies (length, uppercase, lowercase, digits, special chars)
  • 🎯 Default policy with sensible security defaults
  • πŸ”„ Supports configuration via lambda or predefined policy objects
  • 🧩 Compatible with .NET 8 and later

πŸ“š Table of Contents

  1. Getting Started
  2. Examples
  3. Technical Information
  4. Known Issues & Limitations
  5. Contributing
  6. License

🚦 Getting Started

Use Simple.PasswordGenerator to generate strong, policy-compliant passwords easily.

πŸ“¦ Installing

Add the package via NuGet:

dotnet add package Simple.PasswordGenerator

πŸ§ͺ Basic Usage

var generator = new PasswordGenerator();
var password = generator.Generate();
Console.WriteLine($"Generated password: {password}");

🎯 Advanced Usage

Configure a custom password policy using a lambda:

var password = generator.Generate(policy =>
{
    policy.Length = 20;
    policy.RequireSpecial = false;
    policy.RequireDigit = true;
    policy.RequireUppercase = true;
    policy.RequireLowercase = true;
});

Or generate using a predefined PasswordPolicy object:

var policy = new PasswordPolicy
{
    Length = 12,
    RequireSpecial = true,
    RequireDigit = true,
    RequireUppercase = false,
    RequireLowercase = true,
    SpecialCharacters = "@#$"
};
var passwordFromPolicy = generator.Generate(policy);

πŸ–ΌοΈ Examples

using Simple.PasswordGenerator;

var passwordGenerator = new PasswordGenerator();

// Default policy password
var defaultPassword = passwordGenerator.Generate();
Console.WriteLine($"Default policy password: {defaultPassword}");

// Custom policy via lambda
var customPassword = passwordGenerator.Generate(policy =>
{
    policy.Length = 20;
    policy.RequireSpecial = false;
    policy.RequireDigit = true;
    policy.RequireUppercase = true;
    policy.RequireLowercase = true;
});
Console.WriteLine($"Custom policy password: {customPassword}");

// Using a PasswordPolicy instance
var policyInstance = new PasswordPolicy
{
    Length = 12,
    RequireSpecial = true,
    RequireDigit = true,
    RequireUppercase = false,
    RequireLowercase = true,
    SpecialCharacters = "@#$"
};
var policyPassword = passwordGenerator.Generate(policyInstance);
Console.WriteLine($"Password from policy instance: {policyPassword}");

πŸ”¬ Technical Information

  • Uses System.Security.Cryptography.RandomNumberGenerator for secure randomization
  • Password policy validation ensures minimum length and at least one character from required categories
  • Character categories: uppercase, lowercase, digits, and customizable special characters
  • Password characters shuffled with Fisher–Yates algorithm for unpredictability

🐞 Known Issues & Limitations

  • No support yet for exclusion of ambiguous characters (e.g., 'O' vs '0')
  • No built-in localization or culture-specific character sets
  • Does not support password strength estimation or entropy reporting

🀝 Contributing

Bug reports, feature requests, and pull requests are welcome!
Please open an issue or submit a PR via GitHub Issues.


πŸ“„ License

This project is licensed under the MIT License.

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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
1.0.8 1,124 7/14/2025
1.0.7 1,092 7/14/2025
1.0.6 1,093 7/14/2025
1.0.5 1,104 7/14/2025
1.0.4 1,096 7/14/2025
1.0.3 1,098 7/14/2025