DiSHACrypt 1.1.0
dotnet add package DiSHACrypt --version 1.1.0
NuGet\Install-Package DiSHACrypt -Version 1.1.0
<PackageReference Include="DiSHACrypt" Version="1.1.0" />
<PackageVersion Include="DiSHACrypt" Version="1.1.0" />
<PackageReference Include="DiSHACrypt" />
paket add DiSHACrypt --version 1.1.0
#r "nuget: DiSHACrypt, 1.1.0"
#:package DiSHACrypt@1.1.0
#addin nuget:?package=DiSHACrypt&version=1.1.0
#tool nuget:?package=DiSHACrypt&version=1.1.0
DiSHACrypt
Implementation of 'Unix crypt using SHA-256 and SHA-512'
This project provides an implementation of the 'Unix crypt using SHA-256 and SHA-512' algorithm (as specified by Ulrich Drepper in https://www.akkadia.org/drepper/SHA-crypt.txt).
It also includes a variant for MySQL's caching_sha2_password authentication plugin.
Example Usage
Generate SHA-256 digest string with random salt and default rounds
using DiSHACrypt;
string digestString1 = new SHACryptSHA256().Crypt("my-SECURE-password!");
Console.WriteLine($"SHA-256 digest with random salt and default rounds:\n{digestString1}");
Generate SHA-256 digest string with specified salt and default rounds
using DiSHACrypt;
string digestString2 = new SHACryptSHA256().Crypt("a_password", "my.SALT");
Console.WriteLine($"\nSHA-256 digest with specified salt and default rounds:\n{digestString2}");
Generate SHA-512 digest string with specified salt and rounds
using DiSHACrypt;
string digestString3 = new SHACryptSHA512().Crypt("yetanotherpwd", "yetanothersalt", 7000);
Console.WriteLine($"\nSHA-512 digest with specified salt and rounds:\n{digestString3}");
Generate MySQL caching_sha2_password authentication string with random salt and specified rounds
using DiSHACrypt;
string digestString4 = new SHACryptMySqlSHA256().Crypt("Another-password?", rounds: 15000);
Console.WriteLine($"\nMySQL caching_sha2_password authentication string:\n{digestString4}");
Verification of a candidate password against a previously stored digest string
using DiSHACrypt;
string digestString5 = new SHACryptSHA256().Crypt("my-SECURE-password!");
bool isMatch5 = SHACryptFactory.Verify(digestString5, "my-SECURE-password!");
Console.WriteLine($"\nVerification of candidate password against stored digest: {isMatch5}");
| 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 is compatible. 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. |
-
net10.0
- No dependencies.
-
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.
- New SHACryptFactory, SHACryptDigest, TryParseDigest, and constant-time Verify.
- New CheckSalt/CheckAndAdjustSalt with CheckSaltResult.
- Crypt(string?, ...) returns "*" for null passwords instead of throwing.
- Fixed Unix salt charset typo.
- Added .NET 10 target.