// https://atmarkit.itmedia.co.jp/fdotnet/dotnettips/964computehash/computehash.html using System; using System.Security.Cryptography; using System.Text; class Program { static void Main() { string originalText = Console.ReadLine(); // テキストをUTF-8エンコードでバイト配列化 byte[] byteValue = Encoding.UTF8.GetBytes(originalText); // MD5のハッシュ値を取得する MD5 crypto = new MD5CryptoServiceProvider(); byte[] hashValue = crypto.ComputeHash(byteValue); // バイト配列をUTF8エンコードで文字列化 StringBuilder hashedText = new StringBuilder(); for (int i = 0; i < hashValue.Length; i++) { hashedText.AppendFormat("{0:x2}", hashValue[i]); } string originalText2 = hashedText.ToString(); // テキストをUTF-8エンコードでバイト配列化 byte[] byteValue2 = Encoding.UTF8.GetBytes(originalText2); // MD5のハッシュ値を取得する MD5 crypto2 = new MD5CryptoServiceProvider(); byte[] hashValue2 = crypto.ComputeHash(byteValue2); // バイト配列をUTF8エンコードで文字列化 StringBuilder hashedText2 = new StringBuilder(); for (int i = 0; i < hashValue2.Length; i++) { hashedText2.AppendFormat("{0:x2}", hashValue2[i]); } Console.WriteLine(hashedText2.ToString()); } }