c# sha1 password example
System.Security.Cryptography.SHA1 hasher = System.Security.Cryptography.SHA1.Create();
string Password = "1234";
// Convert to bytes
Byte[] PasswordAsBytes = System.Text.Encoding.UTF8.GetBytes(Password);
// Hash bytes
Byte[] HashedPassword = hasher.ComputeHash(PasswordAsBytes);
Console.Write("Password: ");
// Get Input
string Input = Console.ReadLine();
// Convert to bytes
Byte[] InputAsBytes = System.Text.Encoding.UTF8.GetBytes(Input);
// Hash bytes
Byte[] HashedInput = hasher.ComputeHash(InputAsBytes);
// To compare, turn all to string
// Bytes to bytes doesn't work. I don't know why.
string HashedPasswordString = System.Text.Encoding.UTF8.GetString(HashedPassword);
string HashedInputString = System.Text.Encoding.UTF8.GetString(HashedInput);
if (HashedInputString == HashedPasswordString)
{
Console.WriteLine("Your password matches.");
}
else
{
Console.WriteLine("Your password doesn't match.");
}
Convert.FromBase64String("asdafaw");
// If you don't want the un-hashed string to be in the code:
HashedPasswordString = "q\u0010��О\u0006*�䣐��r�\r,\u0002";
// Just paste the hashed and converted to string version of the password to "HashedPasswordString"