PasswordTheBest 2.0.0
dotnet add package PasswordTheBest --version 2.0.0
NuGet\Install-Package PasswordTheBest -Version 2.0.0
<PackageReference Include="PasswordTheBest" Version="2.0.0" />
<PackageVersion Include="PasswordTheBest" Version="2.0.0" />
<PackageReference Include="PasswordTheBest" />
paket add PasswordTheBest --version 2.0.0
#r "nuget: PasswordTheBest, 2.0.0"
#addin nuget:?package=PasswordTheBest&version=2.0.0
#tool nuget:?package=PasswordTheBest&version=2.0.0
PasswordTheBest 🔒
PasswordTheBest is the best password library for .NET. It provides password validation and password hashing to help you follow the best password practices. Advanced password security toolkit with multiple hashing implementations
🔐 Supported Algorithms
✅ Recommended for Production
Class | Algorithm | Security | Ideal For |
---|---|---|---|
PasswordHash256Salt |
PBKDF2-SHA256 | High | Most web applications |
PasswordHash512Salt |
PBKDF2-SHA512 | Very High | Financial systems |
⚠️ Legacy Support Only
Class | Algorithm | Status | Risk Level |
---|---|---|---|
PasswordHashSHA1Salt |
PBKDF2-SHA1 | Deprecated | Critical Security Risk |
PasswordHashMD5Salt |
MD5 | Broken | Extreme Vulnerability |
Getting Started
Prerequisites
- .NET 6.0 SDK or later
Installation
You can install the PasswordTheBest library via NuGet Package Manager:
dotnet add package PasswordTheBest
Usage
Password Validation
To validate a password, use the CPasswordValidation class:
using PasswordTheBest.Validations;
CPasswordValidation cPasswordValidation = CPasswordValidation.Create(password, new CProperties
{
Minimum = 6,
IsAtLeastOneDigit = true,
IsAtLeastOneSpecialCharacter = true
});
bool resultActual = cPasswordValidation.ValidPassword();
Password Hashing
Simple for implement:
using PasswordTheBest;
var password = "password";
var passwordHasher = PasswordTheBestFactory.Create(HashAlgorithmName.SHA256);
var hash = passwordHasher.Hash(password, out string salt);
🛡️ Password Strength Analysis
// Example: Enforce strong passwords
var analyzer = new PasswordStrengthAnalyzer();
if (analyzer.Analyze(userPassword) < PasswordStrength.Strong)
{
// Require better password
}
Metrics Checked:
- Length (12+ chars recommended)
- Character diversity (upper/lower/numeric/special)
- Common password patterns
- Repeated characters
- Mixed case and special char combinations
🔐 Best Practices for Password Security
1. Algorithm Selection
- Recommended: PasswordHash512Salt (PBKDF2-SHA512)
- Acceptable: PasswordHash256Salt (PBKDF2-SHA256)
- Deprecated: PasswordHashSHA1Salt (Only for legacy systems)
- Forbidden: PasswordHashMD5Salt (Never use in production)
2. Configuration Guidelines
Parameter | Minimum Value | Recommended Value | Notes |
---|---|---|---|
Iterations | 100,000 | 350,000 | Adjust based on server load |
Salt Size | 16 bytes | 32 bytes | Must be cryptographically random |
Hash Output | 32 bytes | 64 bytes | Longer = more collision-resistant |
3. Implementation Checklist
// ✔️ DO THIS:
var secureHasher = new PasswordHash512Salt(
hashSize: 64,
saltSize: 32,
iterations: 350000
);
// ❌ AVOID THIS:
var weakHasher = new PasswordHashMD5Salt(); // Vulnerable to rainbow tables
4. Storage Requirements
- Always store:
- The hash (Base64 encoded)
- The salt (Base64 encoded)
- Algorithm version/parameters
- Never store:
- Plaintext passwords
- Unsalted hashes
- Weak algorithm indicators (e.g., "MD5")
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.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.