Simple.PasswordGenerator
1.0.3
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
<PackageReference Include="Simple.PasswordGenerator" Version="1.0.3" />
<PackageVersion Include="Simple.PasswordGenerator" Version="1.0.3" />
<PackageReference Include="Simple.PasswordGenerator" />
paket add Simple.PasswordGenerator --version 1.0.3
#r "nuget: Simple.PasswordGenerator, 1.0.3"
#:package Simple.PasswordGenerator@1.0.3
#addin nuget:?package=Simple.PasswordGenerator&version=1.0.3
#tool nuget:?package=Simple.PasswordGenerator&version=1.0.3
Simple.PasswordGenerator
π 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
π¦ 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.RandomNumberGeneratorfor 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 | 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. |
-
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.