In last blog I had explained that how to implement cryptography by using SHA1 algorithm. In this article I will describe another method to implement concept of Cryptography in C#. Here I will use MD5 algorithm to encrypt data from user.

Following code demonstrate use of MD5 algorithm
public static void encryptMd5() 
            string strText = "";
            Console.Write("Enter Name of Text--->   ");
            strText = Console.ReadLine();
            MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();
            byte[] encryptData = provider.ComputeHash(Encoding.Default.GetBytes(strText));
            Console.WriteLine("Encrypted Value Is....");
            foreach (byte tempData in encryptData)

Output of the above code snippet is as follows

Enter Name of Text--->   MindStick
Encrypted Value Is....

Enter Name of Text--->   Washington
Encrypted Value Is....

  Modified On Sep-18-2014 01:23:54 PM

Leave Comment