Gaurav Taneja

Great dreams... never even get out of the box. It takes an uncommon amount of guts to put your dreams on the line, to hold them up and say, "How good or how bad am I?" That's where courage comes in.

  Home  |   Contact  |   Syndication    |   Login
  82 Posts | 1 Stories | 40 Comments | 7 Trackbacks

News




Google RankGoogle PR™ - Post your Page Rank with MyGooglePageRank.com



The content on this site represents my own personal opinions and thoughts at the time of posting, and does not reflect those of my employer's in any way.

Disclaimer:- All postings in this blog is provided "AS IS" with no warranties, and confers no rights.

Archives

Post Categories

Image Galleries

Atlas

Error

OutLook

SharePointService

Usefull Site Links

Encrypts th string to a byte array using the MD5 Encryption Algorithm

  public static string MD5Encryption(string strToEncrypt)
        {
            string strEnctypted = string.Empty;
            // Create instance of the crypto provider.
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            // Create a Byte array to store the encryption to return.
            byte[] hashedbytes;
            // Required UTF8 Encoding used to encode the input value to a usable state.
            UTF8Encoding textencoder = new UTF8Encoding();

            // let the show begin.
            hashedbytes = md5.ComputeHash(textencoder.GetBytes(strToEncrypt));

            // Destroy objects that aren't needed.
            md5.Clear();
            md5 = null;

            // return the hased bytes to the calling method.
            System.Text.Encoding enc = System.Text.Encoding.ASCII;
            strEnctypted = enc.GetString(hashedbytes);
            return strEnctypted;
        }
posted on Sunday, April 06, 2008 10:27 PM