SecurityUtils.MD5.cs 526 B

12345678910111213141516171819202122
  1. using System.Text;
  2. namespace XGame.Framework.Utils
  3. {
  4. /// <summary>
  5. /// 安全性工具类
  6. /// </summary>
  7. public static partial class SecurityUtils
  8. {
  9. public static string MD5(string input)
  10. {
  11. var output = MD5(Encoding.UTF8.GetBytes(input));
  12. return output.ToHexString();
  13. }
  14. public static byte[] MD5(byte[] input)
  15. {
  16. var md5 = System.Security.Cryptography.MD5.Create();
  17. return md5.ComputeHash(input);
  18. }
  19. }
  20. }