Reputation: 165
I was wondering how hash_file works? The PHP manual states: hash_file — Generate a hash value using the contents of a given file.
So I thought what if I password protect a zip file. Apparently it can still get the contents. So this made me wonder how is the hash value computed for files? Maybe the file header? If anyone knows I would love to know.
Upvotes: 1
Views: 162
Reputation: 32392
You seem to be under the impression that hash_file
requires the unencoded contents of a given file. It does not. In the context of hash_file
, contents means the bits of a file as they are written to the disk. If a file happens to be encoded or encrypted then it will happily take the scrambled contents and produce a hash for that.
Upvotes: 1