備忘録

備忘録

C# MD5を計算させる

private string CalculateMD5(string str)
{
    using (var md5 = MD5.Create())
    {
        var bs = md5.ComputeHash(new UTF8Encoding().GetBytes(str));
        return BitConverter.ToString(bs).ToLower().Replace("-", "");
    }
}