C#, Microsoft Windows

Hashing text with SHA-256 in C#

A simple c# method to produce hashes from plain text using SHA-256 algorithm in visual c#!

1
2
3
4
5
6
public String Hash_SHA256(String plainText)
{
            byte[] inputBytes = Encoding.UTF8.GetBytes(plainText);
            byte[] hashedBytes = (new SHA256CryptoServiceProvider()).ComputeHash(inputBytes);
            return BitConverter.ToString(hashedBytes).Replace("-", string.Empty).ToLower();
}