PassLatch.Core 0.2.0-alpha

This is a prerelease version of PassLatch.Core.
dotnet add package PassLatch.Core --version 0.2.0-alpha
                    
NuGet\Install-Package PassLatch.Core -Version 0.2.0-alpha
                    
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="PassLatch.Core" Version="0.2.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PassLatch.Core" Version="0.2.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="PassLatch.Core" />
                    
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 PassLatch.Core --version 0.2.0-alpha
                    
#r "nuget: PassLatch.Core, 0.2.0-alpha"
                    
#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 PassLatch.Core@0.2.0-alpha
                    
#: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=PassLatch.Core&version=0.2.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PassLatch.Core&version=0.2.0-alpha&prerelease
                    
Install as a Cake Tool

PassLatch.Core

NuGet License: MIT

Cross-platform password validation and generation library for .NET 8.0+ with comprehensive security features.

Features

  • Password Strength Validation

    • Real-time entropy calculation
    • Six-level strength classification (Invalid, Weak, Fair, Good, Strong, Excellent)
    • Detailed validation feedback with actionable suggestions
  • Pattern Detection

    • Repeating characters (e.g., "aaa", "111")
    • Keyboard patterns (e.g., "qwerty", "asdf")
    • Sequences (e.g., "abc", "123")
  • Dictionary Checking

    • 76,000+ common passwords, words, and names (all license-compatible sources)
    • Leet-speak variant detection (e.g., "p@ssw0rd" → "password")
    • Embedded resources for zero-configuration deployment
  • Secure Password Generation

    • Cryptographically secure random generation
    • Configurable length (8-64 characters)
    • Customizable character types
    • Automatic quality assurance
    • No repeated adjacent characters

Installation

Install via NuGet Package Manager:

dotnet add package PassLatch.Core

Or via Package Manager Console:

Install-Package PassLatch.Core

Quick Start

Password Validation

using PassLatch.Core;

var validator = new PasswordValidator();
var result = validator.ValidatePassword("MyP@ssw0rd!");

Console.WriteLine($"Strength: {result.OverallStrength}");
Console.WriteLine($"Summary: {result.Summary}");

foreach (var check in result.Checks)
{
    Console.WriteLine($"[{check.Severity}] {check.Message}");
}

Password Generation

using PassLatch.Core;

var generator = new PasswordGenerator();

// Generate with default settings (16 chars, all types)
string password = generator.GeneratePassword();

// Generate with custom settings
string customPassword = generator.GeneratePassword(
    length: 20,
    includeUppercase: true,
    includeLowercase: true,
    includeDigits: true,
    includeSymbols: true,
    excludeChars: "O0Il1"  // Avoid ambiguous characters
);

Console.WriteLine($"Generated: {customPassword}");

API Reference

PasswordValidator

Validates password strength and provides detailed feedback.

Methods

ValidationResult ValidatePassword(string password)

Validates a password and returns detailed results.

ValidationResult Properties
Property Type Description
OverallStrength PasswordStrength Strength level (Invalid, Weak, Fair, Good, Strong, Excellent)
Summary string Human-readable summary
Checks List<ValidationCheck> Detailed validation checks
EntropyBits double Calculated entropy in bits
ValidationCheck Properties
Property Type Description
Message string Check description
Severity CheckSeverity Info, Warning, or Error

PasswordGenerator

Generates cryptographically secure random passwords.

Methods

string GeneratePassword(int length = 16, bool includeUppercase = true, bool includeLowercase = true, bool includeDigits = true, bool includeSymbols = true, string excludeChars = null, int maxAttempts = 100)

Generates a password meeting the specified criteria.

Parameters
Parameter Type Default Description
length int 16 Password length (8-64)
includeUppercase bool true Include A-Z
includeLowercase bool true Include a-z
includeDigits bool true Include 0-9
includeSymbols bool true Include special characters
excludeChars string null Characters to exclude
maxAttempts int 100 Max generation attempts

DictionaryChecker

Checks passwords against common dictionary words.

Methods

static (bool found, List<string> matches) CheckPassword(string password)

Checks if password contains dictionary words.

static (bool success, int count, string message) GetLoadStatus()

Returns dictionary loading status.

Examples

Complete Validation Example

using PassLatch.Core;

var validator = new PasswordValidator();
var password = "MySecureP@ssw0rd2024!";
var result = validator.ValidatePassword(password);

// Check overall strength
if (result.OverallStrength >= PasswordStrength.Strong)
{
    Console.WriteLine("✓ Password is strong enough");
}
else
{
    Console.WriteLine("✗ Password needs improvement");

    // Show specific issues
    foreach (var check in result.Checks.Where(c => c.Severity == CheckSeverity.Error))
    {
        Console.WriteLine($"  - {check.Message}");
    }
}

// Show entropy
Console.WriteLine($"Entropy: {result.EntropyBits:F1} bits");

Advanced Password Generation

using PassLatch.Core;

var generator = new PasswordGenerator();

try
{
    // Generate password excluding ambiguous characters
    string password = generator.GeneratePassword(
        length: 24,
        includeUppercase: true,
        includeLowercase: true,
        includeDigits: true,
        includeSymbols: true,
        excludeChars: "O0Il1|`~"  // Exclude confusing chars
    );

    Console.WriteLine($"Generated: {password}");

    // Validate the generated password
    var validator = new PasswordValidator();
    var result = validator.ValidatePassword(password);
    Console.WriteLine($"Strength: {result.OverallStrength}");
}
catch (ArgumentException ex)
{
    Console.WriteLine($"Error: {ex.Message}");
}

Dictionary Status Check

using PassLatch.Core;

var (success, count, message) = DictionaryChecker.GetLoadStatus();

Console.WriteLine($"Dictionary Status: {message}");
Console.WriteLine($"Entries Loaded: {count:N0}");

if (!success)
{
    Console.WriteLine("⚠ Using fallback dictionary");
}

Dictionary Details

The library includes three embedded dictionaries:

Dictionary Entries Source
Common Passwords 10,001 SecLists (MIT)
Common Words 46,694 ENABLE1 (Public Domain)
Common Names 19,345 US Census (CC0)
Total 76,040

Dictionaries are embedded as resources for zero-configuration deployment.

Security Features

  • Cryptographically Secure RNG: Uses System.Security.Cryptography.RandomNumberGenerator
  • No Password Storage: All validation is in-memory only
  • Thread-Safe: Dictionary loading uses lazy initialization with thread safety
  • Embedded Resources: No external file dependencies
  • Cross-Platform: Works on Windows, Linux, and macOS

Requirements

  • .NET 8.0 or higher
  • No external dependencies

Performance

  • Dictionary Loading: ~50ms first time (lazy loaded)
  • Validation: ~1-5ms per password
  • Generation: ~5-15ms per password

Contributing

Contributions are welcome! Please see the main PassLatch repository for contribution guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

For information about third-party dictionary source licenses, see the LICENSE file.

  • PassLatch - Windows Forms UI application using this library

Changelog

v0.2.0-alpha (2025-12-18)

  • BREAKING: Removed 446 words from dictionary (Google 10k source with licensing restrictions)
  • All dictionaries now use license-compatible sources only (SecLists MIT, ENABLE1 Public Domain, US Census CC0)
  • Total dictionary entries: 76,040 (down from 76,486)
  • No functional changes to API or behavior
  • Full release notes

v0.1.0-alpha (2025-12-16) - UNLISTED

  • Initial release with 76K+ dictionary entries
  • Unlisted due to licensing issues with Google 10k word list
  • Full release notes

Support


Made with ☕ by alatch

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.0-alpha 231 12/18/2025