// 文字列ををUTF-8でバイト型に変換
string strdata = "[暗号化したい文字列]";
byte[] byteValue = Encoding.UTF8.GetBytes(strdata);
// SHA256のハッシュ値を取得する
SHA256 crypto = new SHA256CryptoServiceProvider();
byte[] hashValue = crypto.ComputeHash(byteValue);
// バイト配列をUTF8エンコードで文字列に変換
StringBuilder hashedText = new StringBuilder();
for (int i = 0; i < hashValue.Length; i++) {
hashedText.AppendFormat("{0:X2}", hashValue[i]);
}
// 暗号化された文字列
hashedText.ToString()