SHA256 encryption with salt value in Asp.net
SHA256 encryption with salt value in Asp.net
Import namespace
using System.Security.Cryptography;
Logic
string sha;
string salt="deol";
string ste_enc="Kandyhere";
protected void Page_Load(object sender, EventArgs e)
{
sha = getc(ste_enc + salt);
Response.Write(sha);
}
public string getc(string qcc)
{
HashAlgorithm hashAlg = new SHA256CryptoServiceProvider();
byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(qcc);
byte[] bytHash = hashAlg.ComputeHash(bytValue);
string bas2 = Convert.ToBase64String(bytHash);
return bas2;
}
Output will be :-
+A3ctv1SZ7wB0hWQkMluiNmzTvsY3U1naFyD2grva3M=
Comments
Post a Comment