123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading.Tasks;
- namespace Ropin.Inspection.Model.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();
- }
- }
- }
|