NuGet Package ID: CodeBits.SaltedHash

The SaltedHash class can:
  • Compute salted hashes from an input string (typically a password)
  • Verify that a string matches a given salted hash

To compute a salted hash, use the SaltedHash.Compute static method:
SaltedHash saltedHash = SaltedHash.Compute(myPassword);
Console.WriteLine("Hash value: {0}", saltedHash.Hash);
Console.WriteLine("Salt value: {0}", saltedHash.Salt);

To verify a password against the hash and salt value, use the SaltedHash.Verify method:
bool matches = SaltedHash.Verify(myPassword, hashValue, saltValue);
Console.WriteLine("Password matches: {0}", matches);

Last edited Jul 14, 2012 at 8:10 PM by jeevanjj, version 1


No comments yet.