I want to compare password when user logins from ASP.NET Site to One I generated for him in SQL Server.
So, I generate password field in SQL server like this:
insert into users
select 'username', HASHBYTES('SHA2_512', CONVERT(nvarchar(4000),'password'))
And code in C#:
string text = Password;
SHA512 alg = SHA512.Create();
byte[] result = alg.ComputeHash(Encoding.UTF8.GetBytes(text));
string hash = Encoding.UTF8.GetString(result);
And those two hashes are very different.
Where am I wrong?