How to get a string in MD5 in C#.Net

Here it is:

        public static String getInMD5(String inputString) {
            byte[] input = Encoding.UTF8.GetBytes(inputString);
            byte[] output = MD5.Create().ComputeHash(input);
            StringBuilder sb = new StringBuilder(output.Length);
            for (int i = 0; i < output.Length; i++) {
                sb.Append(output[i].ToString("X2"));
            }
            return sb.ToString();
        }

You may need this too:

using System.Text;
using System.Security.Cryptography;

Leave a Reply

Close Bitnami banner
Bitnami