File magic

From Helpful
Jump to navigation Jump to search


File magic refers to data that makes it easy to identify what kind of file it is. Also known as file signature.

This is

sometimes this is data that is intentionally there for that purpose alone,
at other times is just a fixed part of the structure that works out as a pretty strong indicator and distinguishes it from other things
and occasionally is less about seeing known data, and more about known structure - starting to parse that file, and seeing whether it keeps making sense. How much you have to parse before you can be sure will vary - usually not a lot, but it does avoid some false positives)


File magic can also refer to the tools that put in the actual work to identify and distinguish lots of files this way, e.g. backing the file tool on *nix.



https://en.wikipedia.org/wiki/List_of_file_signatures

https://en.wikipedia.org/wiki/Magic_number_(programming)