Unity/Csharp/md5
提供: 初心者エンジニアの簡易メモ
サンプルコード
// KeyUtility.md5("hoge"); public class KeyUtility { public static string md5( string srcStr ) { System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create(); byte[] srcBytes = System.Text.Encoding.UTF8.GetBytes(srcStr); byte[] destBytes = md5.ComputeHash(srcBytes); System.Text.StringBuilder destStrBuilder; destStrBuilder = new System.Text.StringBuilder(); foreach (byte curByte in destBytes) { destStrBuilder.Append(curByte.ToString("x2")); } return destStrBuilder.ToString(); } }