Finding the HEX value of a file

G

Guest

Hi all,

I need to find out the hex value of a file. Is this possible? I need to be able to quickly access and confirm its extension against its file type (which is as far as i know defined by its hex value).

Thanks,

/Jonny
 
L

Lasse Vågsæther Karlsen

Hi all,

I need to find out the hex value of a file. Is this possible? I need
to be able to quickly access and confirm its extension against its
file type (which is as far as i know defined by its hex value).

What is "file type" in this context ?

If I read this question correctly, you want to check if a file has the
correct file extension (like .AVI) depending on the content ? If that's
correct, then no, there is no single way of doing this.

Most files store some kind of signature at the very start so that the
program that use the file can easily check if the file is correct or not.
However, some files doesn't store the signature at the very start and some
files has it at the end, some just a checksum, etc.

In short, there's no "hex value" for a file that uniquely identifies its
type.

However, it might be that I misunderstood your question, in which case
ignore this reply :)
 
M

Morten Wennevik

Hi Jonny,

I never heard of a hex value for a file (which doesn't necessarily mean it doesn't exist). The only way you can be absolutely sure what kind of file it is, is to try to read it (and in some cases you can't even be sure then). For image files, the first bytes of the file typically indicate what type of image file it is, something some image viewers take advantage of, displaying the correct image despite having the wrong file extension.

For a given file type, see if the first bytes of the file is the same as expected for that file type.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top