13

When reverse-engineering, you often have to make sense out of values like SGkgVG9tYXMh. Most often, such values are just encoded with a simple algorithm like Base64/BinHex/Uuencoding/Xxencoding/GEDCOM/Ascii85/6PACK/etc.

My dream would be a program that would take my string and decode it using about a hundred different common decoding algorithm, and output the result. A quick look at the hundred results would quickly tell me what is the right algorithm:

SGkgVG9tYXMh →  æ–‡å—化ã‘
                hÃ⁠¤Ã⁠¤yÃ⁠¶
                µRVÖZTëRŠ TšK™
                Hi Tomas!              ← I find this one visually
                þjóðlöð
                я╗┐╪з┘Д╪е╪╣┘

Free, preferably usable offline, ideally a JavaScript/HTML page hosted and runnable directly from Github/Gitlab. Any other software form is OK, any OS is OK.

6
  • Does it have to be a web application, or is command-line ok? Oct 12, 2015 at 22:18
  • @bariumbitmap: Any is fine!
    – Nicolas Raoul
    Oct 13, 2015 at 6:48
  • Any OS preferences? Oct 14, 2015 at 4:28
  • @bariumbitmap: Any OS is OK.
    – Nicolas Raoul
    Oct 14, 2015 at 5:31
  • There is an open-source python project that tries to determine the HASH algorithm used to encode a string github.com/psypanda/hashID, however, I never seen anything similar about encryption algorithms. Maybe you will consider to make a bounty because the existance of this software could be very hard to discover. Oct 17, 2015 at 4:18

1 Answer 1

4

I found this idea intriguing, but I couldn't find anything that already existed, so I wrote a Python3 script that does it. Here's an example of its output:

$ printf 'SGkgVG9tYXMh' | python3 try_decodings.py
Base64  : Hi Tomas!
Ascii85 : b'\x9c\xfeA\xadw%\xd1\xc8\x8b'
Base85  : b'W\xb9\x92{2"\xbd\x0fF'
ROT13   : FTxtIT9gLKZu
Failed to decode: Base32, Base16, Uuencoding, BinHex
Output same as input: MIME quoted-printable, Percent-encoding, HTML

The code is here:

https://github.com/nbeaver/try-decodings

It doesn't check for Unicode encoding issues, but it does try to convert bytes to the default encoding if possible.

7
  • I tried it, but it seems to encode then decode, round-trip? I am looking for a tool that only decodes. I would give my dream tool an already-encoded string, and it would show decoded strings.
    – Nicolas Raoul
    Oct 21, 2015 at 5:02
  • It does decode, but runs a round-trip self-test if there are no arguments. Don't forget the - afterward. Right now it takes both stdin and filenames, although I'm thinking about changing that, since it's somewhat confusing. Oct 21, 2015 at 13:23
  • Indeed I had forgotten the - it seems thanks :-)
    – Nicolas Raoul
    Oct 22, 2015 at 3:07
  • Good. Feel free to email me or open a Github request if you run into any trouble. The binhex output in particular has some issues I haven't fixed yet. Oct 22, 2015 at 4:49
  • 1
    Might want to include a test so that if a given encoding spits out unchanged text, it's suppressed. Oct 22, 2015 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.