5 changed files with 32 additions and 2 deletions
			
			
		| @ -0,0 +1,26 @@ | |||
| using System; | |||
| using System.Text; | |||
| using System.Security.Cryptography; | |||
| 
 | |||
| namespace Pingchuan.BeijingSafeguard.Utility | |||
| { | |||
|     public class Helper | |||
|     { | |||
|         public static string CalcMD5(string input) | |||
|         { | |||
|             // Use input string to calculate MD5 hash
 | |||
|             using (MD5 md5 = MD5.Create()) | |||
|             { | |||
|                 byte[] inputBytes = Encoding.ASCII.GetBytes(input); | |||
|                 byte[] hashBytes = md5.ComputeHash(inputBytes); | |||
| 
 | |||
|                 // Convert the byte array to hexadecimal string
 | |||
|                 StringBuilder sb = new StringBuilder(); | |||
|                 for (int i = 0; i < hashBytes.Length; i++) | |||
|                     sb.Append(hashBytes[i].ToString("x2")); | |||
| 
 | |||
|                 return sb.ToString(); | |||
|             } | |||
|         } | |||
|     } | |||
| } | |||
					Loading…
					
					
				
		Reference in new issue