0

What could be the reason ? Aren't there any property of the files that could be responsible to produce different hashes using SHA 256 ?

Creation time is same.modification time is different.

7
  • I see no reason of having different hashes on the same files. The whole idea of hash is to check if content is the same.
    – Pilot6
    Dec 1, 2019 at 12:00
  • In case of fake certificates , it is useful. Suppose a fake certificate is created like a genuine one and can't be differentiated apparently. Will hash algorithms useful in this case ? Dec 1, 2019 at 12:10
  • As far as I know certificates have dates inside the file. Changing them will affect the hash.
    – Pilot6
    Dec 1, 2019 at 12:14
  • 1
    How did you create the two files? Files have to be byte to byte identical. One extra space in a text file with the "same" content will make the difference.
    – vanadium
    Dec 1, 2019 at 15:09
  • 2
    Certificates is based on public-private pair of keys, and this is orthogonal to your question about calculating a file hash. This is about content encryption/decryption, not about calculating a content hash.
    – Hi-Angel
    Dec 1, 2019 at 15:51

1 Answer 1

2

Aren't there any property of the files that could be responsible to produce different hashes using SHA 256 ?

Creation time is same.modification time is different.

mtime and other file properties is not a part of file content. The "file content" is whatever you can read with "read" C function. You can also use, for example, hexdump -C myfile, which uses read function internally, to see the content of a file "myfile". So if it's the same, hashes would also be the same.

2
  • In case of fake degree certificates , suppose a culprit produce a fake degree which resembles a genuine one. I already have hash of original one given by University itself which is genuine. Now ,since culprits degree certificate is fake , can't I detect it as fake by calculating its hash and compare against hash I already have. Content is same in both degree certificates.How to prove it is fake ? Dec 2, 2019 at 5:53
  • If what you call a "fake certificate" has same content as the genuine one, then it's not a fake. Imagine both certificates has been written to a file. So you read them with read() function or with hexdump utility, and what do you see? If what you see is the same content, then the certificates are the same.
    – Hi-Angel
    Dec 2, 2019 at 7:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .