12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading.Tasks;
- namespace Ropin.Inspection.Common
- {
- public class EncryptUtil
- {
-
-
-
-
-
- public static string Encrypt(string source)
- {
- using MD5 md5Hash = MD5.Create();
- byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(source));
- StringBuilder sBuilder = new StringBuilder();
- foreach (byte t in data)
- {
- sBuilder.Append(t.ToString("x2"));
- }
- string hash = sBuilder.ToString();
- return hash.ToUpper();
- }
-
-
-
-
-
-
- public static bool Verify(string mdPwd, string source)
- {
- return mdPwd == Encrypt(source).ToUpper();
- }
- }
- }
|