While user registration , password is encrypted using SHA algorithm and stored in database. See the below code for encryption.
public static string getSHA(string Password)
{
return "{SHA}" + Convert.ToBase64String(Create_SHA1Hash(Encoding.ASCII.GetBytes(Password)));
}
public static byte[] Create_SHA1Hash(byte[] byInput)
{
SHA1 sha1 = new SHA1CryptoServiceProvider();
return sha1.ComputeHash(byInput);
}
string test = getSHA("password12");
Result is ==> {SHA}EMKPnPBmhZXUXBCQp7Sirpjt+lg=
Now i want to do this encryption in sql server. Can anyone give me an idea? SELECT HashBytes('SHA1', 'password12'); not giving the expected result.
Suresh.
...
Go to the complete details ...