By Team Escalera
on 31 Oct 2017 03:19 PM
  • training

Text to md5 in C Sharp Password Encryption

To Convert a value from TextBox in using C# into md5 hash

use following assembly reference in your page
using System.Security.Cryptography; \\FOR MD5

using System.Text;\\For ASCII encoding

And code :

public string GetMD5(string text)


            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();


            byte[] result = md5.Hash;

            StringBuilder str = new StringBuilder();

            for (int i = 1; i < result.Length; i++)




            return str.ToString();


Now our Method is Created to Convert Strings into MD5

Simply write following Code to Change password.text to a Textbox.Text value.

TextBox.Text = GetMD5(Pass.Text);

Comments (0)

Leave A Comment