A secure and lightweight .NET library for cryptographic operations. Features a cryptographically secure password generator (CSPRNG) and standard hashing utilities (SHA256, SHA512) for data integrity checks.
$ dotnet add package Easy.Tools.SecurityEasy.Tools.Security is a lightweight .NET library designed to simplify common cryptographic operations. It focuses on generating secure random passwords and computing hashes (SHA256, SHA512) with a clean, developer-friendly API.
RandomNumberGenerator (CSPRNG) instead of System.Random to ensure passwords are unpredictable and secure.Install via NuGet Package Manager:
Install-Package Easy.Tools.Security
Or via .NET CLI:
dotnet add package Easy.Tools.Security
Simple usage with default settings (12 chars, all types included):
using Easy.Tools.Security;
string password = PasswordGenerator.Generate();
Console.WriteLine(password);
// Output: "aK9#m!vL2$xP"
Generate a pin code or a specific format:
var options = new PasswordOptions
{
Length = 8,
IncludeUppercase = false,
IncludeLowercase = false,
IncludeNumbers = true,
IncludeSpecialChars = false
};
string pinCode = PasswordGenerator.Generate(options);
Console.WriteLine(pinCode);
// Output: "82910453"
Useful for verifying file integrity or legacy authentication systems.
string input = "Hello World";
string hash = HashHelper.ComputeSha256(input);
Console.WriteLine(hash);
// Output: "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e" return Ok(result.Value);
This library uses System.Security.Cryptography.RandomNumberGenerator for password generation, which is suitable for cryptographic use cases. It avoids the pitfalls of using System.Random which is predictable.
Contributions and suggestions are welcome. Please open an issue or submit a pull request.
This project is licensed under the MIT License.
© 2025 Elmin Alirzayev / Easy Code Tools