授权文件制作工具/源码/LisenceFile/App_Code/MD5Helper.cs

(完整代码) 874B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;

namespace LisenceFile
{
    public class MD5Helper
    {
        private static MD5 md5 = MD5.Create();

        //使用utf8编码将字符串散列
        public static string GetMD5HashString(string sourceStr)
        {
            return GetMD5HashString(Encoding.UTF8, sourceStr);
        }

        //使用指定编码将字符串散列
        public static string GetMD5HashString(Encoding encode, string sourceStr)
        {
            StringBuilder sb = new StringBuilder();

            byte[] source = md5.ComputeHash(encode.GetBytes(sourceStr));
            for (int i = 0; i < source.Length; i++)
            {
                sb.Append(source[i].ToString("x2"));
            }

            return sb.ToString();
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。