Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Decrypting using MD5

Decrypting using MD5

Scheduled Pinned Locked Moved C#
securitycryptographyregexhelptutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 3 Offline
    3 Offline
    3bood ghzawi
    wrote on last edited by
    #1

    Hi all, i use the following code to encrypt a string using MD5: using System.Security.Cryptography; public static string EncodePassword(string originalPassword) { Byte[] originalBytes; Byte[] encodedBytes; MD5 md5; // Conver the original password to bytes; then create the hash md5 = new MD5CryptoServiceProvider(); originalBytes = ASCIIEncoding.Default.GetBytes(originalPassword); encodedBytes = md5.ComputeHash(originalBytes); // Bytes to string return System.Text.RegularExpressions.Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower(); } But i don't know how to decrypt it using MD5 ???????? Do anyone help me ????????? Regards...

    L OriginalGriffO D 3 Replies Last reply
    0
    • 3 3bood ghzawi

      Hi all, i use the following code to encrypt a string using MD5: using System.Security.Cryptography; public static string EncodePassword(string originalPassword) { Byte[] originalBytes; Byte[] encodedBytes; MD5 md5; // Conver the original password to bytes; then create the hash md5 = new MD5CryptoServiceProvider(); originalBytes = ASCIIEncoding.Default.GetBytes(originalPassword); encodedBytes = md5.ComputeHash(originalBytes); // Bytes to string return System.Text.RegularExpressions.Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower(); } But i don't know how to decrypt it using MD5 ???????? Do anyone help me ????????? Regards...

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      MD5 is one way encryption, you cannot decrypt it, you can only compare the encrypted value against a dictionary to see if it matches are predefined list of encrypted strings. See this[^] wikipedia article.

      Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]

      1 Reply Last reply
      0
      • 3 3bood ghzawi

        Hi all, i use the following code to encrypt a string using MD5: using System.Security.Cryptography; public static string EncodePassword(string originalPassword) { Byte[] originalBytes; Byte[] encodedBytes; MD5 md5; // Conver the original password to bytes; then create the hash md5 = new MD5CryptoServiceProvider(); originalBytes = ASCIIEncoding.Default.GetBytes(originalPassword); encodedBytes = md5.ComputeHash(originalBytes); // Bytes to string return System.Text.RegularExpressions.Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower(); } But i don't know how to decrypt it using MD5 ???????? Do anyone help me ????????? Regards...

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        In addition to Elliots response, you should not use MD5 for new applications - it is considered "broken" and should not be used for any new development. Use SHA512 instead, until the SHA 1024 specification comes out in 2012.

        All those who believe in psycho kinesis, raise my hand.

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        1 Reply Last reply
        0
        • 3 3bood ghzawi

          Hi all, i use the following code to encrypt a string using MD5: using System.Security.Cryptography; public static string EncodePassword(string originalPassword) { Byte[] originalBytes; Byte[] encodedBytes; MD5 md5; // Conver the original password to bytes; then create the hash md5 = new MD5CryptoServiceProvider(); originalBytes = ASCIIEncoding.Default.GetBytes(originalPassword); encodedBytes = md5.ComputeHash(originalBytes); // Bytes to string return System.Text.RegularExpressions.Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower(); } But i don't know how to decrypt it using MD5 ???????? Do anyone help me ????????? Regards...

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          You don't. MD5 is a one-way hash. You cannot get the original string back from the encrypted hash.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008
          But no longer in 2009...

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups