Unity/C#
c# MD5
모카쨩
2020. 8. 25. 17:17
v1
public string GetMD5(byte[] data)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
byte[] hash = System.Security.Cryptography.MD5.Create().ComputeHash(data);
foreach (byte b in hash)
{
sb.Append(b.ToString("X2"));
}
return sb.ToString();
}
v2
public string GetMD5(byte[] data)
{
byte[] bytes = System.Security.Cryptography.MD5.Create().ComputeHash(data);
return System.BitConverter.ToString(bytes).Replace("-", "");
}