Blame view

netcore/src/Infrastructure/Antis.Core.Pay/Common/MD5Helper.cs 699 Bytes
de2bd2f9   “wangming”   项目初始化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Security.Cryptography;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace Antis.Pay.Core
  {
      public sealed class MD5Helper
      {
          public static string Sign(string prestr, string _input_charset)
          {
              StringBuilder sb = new StringBuilder(32);
              MD5 md5 = new MD5CryptoServiceProvider();
              byte[] t = md5.ComputeHash(Encoding.GetEncoding(_input_charset).GetBytes(prestr));
              for (int i = 0; i < t.Length; i++)
              {
                  sb.Append(t[i].ToString("x").PadLeft(2, '0'));
              }
  
              return sb.ToString();
          }
      }
  }