using System; using System.Collections.Generic; using System.Runtime.Serialization; using System.Security.Cryptography; using System.Text; namespace ReZero.SuperAPI { public class Encryption { /// /// Encrypt the input string using MD5 hashing algorithm. /// /// The string to encrypt /// The encrypted string in hexadecimal format public static string Encrypt(string input) { using (MD5 md5 = MD5.Create()) { byte[] inputBytes = Encoding.UTF8.GetBytes(input); byte[] hashBytes = md5.ComputeHash(inputBytes); StringBuilder sb = new StringBuilder(); for (int i = 0; i < hashBytes.Length; i++) { sb.Append(hashBytes[i].ToString("X2")); } return sb.ToString().ToLower(); } } } }