-1

Is there any possible way to determine the original format of a binary file?

If No, then we are on the same page, but if yes, then how? What makes a binary format file of pdf different with binary format of a txt file?

Also, can we convert a binary file into it's original format without knowing it's original format?

Kindly help. Thank you!

Ashish Singh
  • 399
  • 4
  • 11
  • 3
    What would be the original format of, say, a jpeg according to your definition? – Federico klez Culloca Aug 13 '20 at 10:39
  • To "binary" or not to "binary" is not the question of the file. It is the way of reading it. (I agree with answer by Or Y, just cannot resist the pun.) – Yunnosch Aug 13 '20 at 10:42
  • Make your mind which language you want to use. Spamming different languages tags that aren't related in any way isn't a good practice. – Amongalen Aug 13 '20 at 10:42
  • 1
    @Amongalen Actually deleting all language tags is probably appropriate as long as the question is that language agnostic. – Yunnosch Aug 13 '20 at 10:43

1 Answers1

2

Eventually, every file is just a stream of bytes. What determines the type of the file is how a program attempts to parse and use it (And of course there are some common agreements).

Some files are created with a magic string inside them that helps a program quickly check (but not actually check as the rest of the file might be corrupted) if a file is of some type, you can see some examples here: https://en.wikipedia.org/wiki/List_of_file_signatures

Or Y
  • 2,088
  • 3
  • 16