-3

I guess most of you already met them. You get them from your data sources, see them in your logs, or in the output from your legacy systems. Some strings you can't really read.

To derive any useful information from them, you need to decode them first. With files, it is often possible to see the header. With text strings that have no header, you need to guess.

Many have been in that situation, and, StackOverflow has an endless supply of one-shot questions on the topic.

Some are fine with that practice... but others don't want to litter SO with overly specific questions and wait for help. In the long run, it's faster to invest some skill points into identification anyway.

Let's do that.

How do you identify that a string is in Base64, JSON, B-encode, or any other data exchange format? What resources do you use - cheat sheets, online tools, something else? Are there any techniques that can be learned, apart of "just seeing it"?

  • 1
    Can downvoters specify, what is wrong with the question, please? Is it, for example, too broad to discuss, or wrong tags, or...? – Martin Grey Feb 4 at 12:56
  • 2
    If you are trying to determine what an arbitrary string of bytes might decode to, then you are doing it wrong. You need to know the context, the source and the destination, and what the content might be. That gets you 80% of the way there. – BobDalgleish Feb 4 at 13:56
  • 1
    What you ask for is just not possible in a general way. E.g. the string "Hello" could be plain text, but it could also be a base64 encoding of some other string. It is simply not possible to tell from the string itself. – JacquesB Feb 4 at 18:24
1

@MartinGrey, I think your question is perfectly sensible, but it's like Bob says in a comment, your misconception is in the idea that handling arbitrary data in arbitrary encodings, and decoding it based only on inferences from the data itself, is a common problem with a well-defined procedural solution.

There are potentially an infinite number of encodings, including small variations between two encodings that generally look similar. If there is limited data, it may be undecidable which of two encodings exactly are in use, even if the possibilities are finite and well-defined.

In terms of a human attempting to interpret the data, there are not really any cheat sheets. People will be familiar with the patterns employed in some common encodings and recognise them quickly.

If a person isn't familiar with an encoding, then you'd be moving into the realm of code-breaking, which relies on a broad range of inferences to establish the encoding and decoding method.

| improve this answer | |
  • Thanks."There is no definite answer" is actually sort of an answer in itself. – Martin Grey Feb 6 at 16:37

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