Philiprehberger.PasswordStrength 0.1.1

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

Philiprehberger.PasswordStrength

CI NuGet License

Password strength evaluation with entropy calculation, common password detection, and pattern analysis.

Installation

dotnet add package Philiprehberger.PasswordStrength

Usage

Evaluate Password Strength

using Philiprehberger.PasswordStrength;

var score = Password.Evaluate("MyP@ssw0rd!");
Console.WriteLine(score.Score);     // 3 (0=very weak, 4=very strong)
Console.WriteLine(score.Entropy);   // 52.4 (bits)
Console.WriteLine(score.CrackTime); // "centuries"
foreach (var tip in score.Feedback)
    Console.WriteLine(tip);

Common Password Detection and Policy Validation

using Philiprehberger.PasswordStrength;

bool common = Password.IsCommon("password123"); // true
bool unique = Password.IsCommon("xK9#mP2!vL");  // false

var policy = new PasswordPolicy(MinLength: 12, MinScore: 3, RejectCommon: true);
bool valid = Password.MeetsPolicy("MyStr0ng!Pass", policy); // true
bool weak  = Password.MeetsPolicy("password", policy);      // false

Entropy Calculation and Pattern Detection

using Philiprehberger.PasswordStrength;

double entropy = EntropyCalculator.Calculate("hello");
Console.WriteLine(entropy); // 23.5 (bits)

string[] patterns = EntropyCalculator.DetectPatterns("qwerty123");
foreach (var pattern in patterns)
    Console.WriteLine(pattern); // "keyboard walk", "sequential characters"

API

Password

Member Description
Evaluate(string password) Evaluate strength and return a PasswordScore
IsCommon(string password) Check if the password is in the top 1000 common passwords
MeetsPolicy(string password, PasswordPolicy policy) Check if the password satisfies the given policy

PasswordScore

Member Description
Score Strength score from 0 (very weak) to 4 (very strong)
Entropy Shannon entropy in bits
CrackTime Human-readable crack time estimate
Feedback Array of improvement suggestions

EntropyCalculator

Member Description
Calculate(string password) Calculate Shannon entropy in bits
DetectPatterns(string password) Detect weakness patterns (sequential, repeated, keyboard walks, substitutions)

PasswordPolicy

Member Description
MinLength Minimum required length (default: 8)
MinScore Minimum required score 0-4 (default: 2)
RejectCommon Reject passwords in the common list (default: true)

Development

dotnet build src/Philiprehberger.PasswordStrength.csproj --configuration Release

License

MIT

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
0.2.1 129 4/1/2026
0.2.0 118 3/28/2026
0.1.1 109 3/25/2026
0.1.0 106 3/23/2026