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
  1. Home
  2. General Programming
  3. C#
  4. How do I generate 6 or 8 digits hash from a string and decode it back??

How do I generate 6 or 8 digits hash from a string and decode it back??

Scheduled Pinned Locked Moved C#
questioncryptography
10 Posts 6 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.
  • C Offline
    C Offline
    candogu
    wrote on last edited by
    #1

    Hello, I need to encode a string to a 6 or 8 digits hash and decode it to original string. Encoded string has to include only numbers and alphabetic characters. Thanks.

    G R J J 4 Replies Last reply
    0
    • C candogu

      Hello, I need to encode a string to a 6 or 8 digits hash and decode it to original string. Encoded string has to include only numbers and alphabetic characters. Thanks.

      G Offline
      G Offline
      GuyThiebaut
      wrote on last edited by
      #2

      My understanding is that the whole point of a hash is that it cannot be decoded back to the original string - let's see if I am proven wrong on this.

      “That which can be asserted without evidence, can be dismissed without evidence.”

      ― Christopher Hitchens

      C 1 Reply Last reply
      0
      • G GuyThiebaut

        My understanding is that the whole point of a hash is that it cannot be decoded back to the original string - let's see if I am proven wrong on this.

        “That which can be asserted without evidence, can be dismissed without evidence.”

        ― Christopher Hitchens

        C Offline
        C Offline
        candogu
        wrote on last edited by
        #3

        It can be hash or something like that, I need to convert a 12 characters long string to 12 characters long string or smaller meaningless one. Thanks for your reply.

        G 1 Reply Last reply
        0
        • C candogu

          Hello, I need to encode a string to a 6 or 8 digits hash and decode it to original string. Encoded string has to include only numbers and alphabetic characters. Thanks.

          R Offline
          R Offline
          Rob Philpott
          wrote on last edited by
          #4

          Come on! You want to convert *any* string and reduce it to 6 or 8 digits, and then be able to convert it back again? Well, if you find a way I'll be impressed. Not to mention that we'll be able to zip anything up in just 6 digits..!

          Regards, Rob Philpott.

          P 1 Reply Last reply
          0
          • C candogu

            Hello, I need to encode a string to a 6 or 8 digits hash and decode it to original string. Encoded string has to include only numbers and alphabetic characters. Thanks.

            J Offline
            J Offline
            joost versteegen
            wrote on last edited by
            #5

            Maybe someone can help you when you explain What it is that are trying to achieve? Why do you need to generate the 'hash' and translate it back?

            C 1 Reply Last reply
            0
            • C candogu

              It can be hash or something like that, I need to convert a 12 characters long string to 12 characters long string or smaller meaningless one. Thanks for your reply.

              G Offline
              G Offline
              GuyThiebaut
              wrote on last edited by
              #6

              In which case just use some sort of algorithm that is applied to the ascii value of the first character, then use the output from this together with the value of the second character to convert the second character and so on(this way it is a little bit harder to crack the sequence of characters). To decode it all you need to do is reverse the process starting from the first character again.

              “That which can be asserted without evidence, can be dismissed without evidence.”

              ― Christopher Hitchens

              1 Reply Last reply
              0
              • J joost versteegen

                Maybe someone can help you when you explain What it is that are trying to achieve? Why do you need to generate the 'hash' and translate it back?

                C Offline
                C Offline
                candogu
                wrote on last edited by
                #7

                I need to generate a meaningless code that includes last 4 characters of MAC address and a date for example; F28D31122014. Thanks.

                J 1 Reply Last reply
                0
                • C candogu

                  I need to generate a meaningless code that includes last 4 characters of MAC address and a date for example; F28D31122014. Thanks.

                  J Offline
                  J Offline
                  joost versteegen
                  wrote on last edited by
                  #8

                  Creating a meaningless code is easy, but it is impossible to regenerate a MAC address from only the last 4 characters. Still don't understand WHY. WHAT are you trying to accomplish?

                  1 Reply Last reply
                  0
                  • C candogu

                    Hello, I need to encode a string to a 6 or 8 digits hash and decode it to original string. Encoded string has to include only numbers and alphabetic characters. Thanks.

                    J Offline
                    J Offline
                    jschell
                    wrote on last edited by
                    #9

                    candogu wrote:

                    I need to encode a string to a 6 or 8 digits hash and decode it to original string

                    That is not possible. And it is proven as well. Now if you want to take a string or binary data and create another string which will only contain alphanumerics then that is fairly easy. In most cases the second string will be longer than the first. You can look to Base64 encoding to see an example of how you might do this. (Base64 is similar to but not exactly the same as what the output you are asking for is.)

                    1 Reply Last reply
                    0
                    • R Rob Philpott

                      Come on! You want to convert *any* string and reduce it to 6 or 8 digits, and then be able to convert it back again? Well, if you find a way I'll be impressed. Not to mention that we'll be able to zip anything up in just 6 digits..!

                      Regards, Rob Philpott.

                      P Offline
                      P Offline
                      Paul Conrad
                      wrote on last edited by
                      #10

                      Rob Philpott wrote:

                      we'll be able to zip anything up in just 6 digits..

                      That would be an incredible compression ratio if one could achieve that :-D

                      "I've seen more information on a frickin' sticky note!" - Dave Kreskowiak

                      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