find a location for property in a new city

Thursday, 8 September 2011

MD5 encryption in .NET

There is not set up needed for this one.

MD5 hash encryption

public static string Md5Encryption(string dataToEncrypt)
    var bytes = Encoding.Default.GetBytes(dataToEncrypt);
    using (var md5 = new MD5CryptoServiceProvider())
        var cipher = md5.ComputeHash(bytes);
        return Convert.ToBase64String(cipher);

Follow britishdev on Twitter


  1. hi, i am new in security concepts of .net.

    But i want to learn it

    Your articles are great but i got problem to decrypt the string that has been encrypted by MD5.

    Could you also post this how could i decrypt the string that is encrypted by MD5

  2. You cannot decrypt MD5 hashes. It is one way encryption. You'd want RSA or Triple DES (or something else) if you want encryption and decryption

  3. Thanks for this information, it was very helpful. Keep up the good work.
    pgp desktop

  4. There are many different types of encryption used in security of the computers but one that is most strong and efficient is the MD5 Hash. Don't ever forget to include a reference to 'System.Security.Cryptography' in your project, it's a must.

  5. Motifz Designer Lawn. 1, 2 & 3 Piece Unstitched Premium Embroidered Lawn 2019, Premium embroidered Lawn, Premium lawn, Premium lawn 2019, Motifz, Premium lawn in Pakistan. Shipping worldwide. Stitching option available.