Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

encrypt password easiest way in web app .net

public static string HashPassword(string password, string algorithm = "sha256")
{
   return Hash(Encoding.UTF8.GetBytes(password), algorithm);
}

private static string Hash(byte[] input, string algorithm = "sha256")
{
    using (var hashAlgorithm = HashAlgorithm.Create(algorithm))
    {
        return Convert.ToBase64String(hashAlgorithm.ComputeHash(input));
    }
}
Source by www.meziantou.net #
 
PREVIOUS NEXT
Tagged: #encrypt #password #easiest #web #app
ADD COMMENT
Topic
Name
8+7 =