How to prove a file was written at a certain date

22 February, 2020


Lets say you wanted to prove a particular text file was written at a particular timestamp, how would you check that? or in other words, how do you check the file integrity of a file? One way to do that is to create a hash out of that text file.

There is a command called shasum which is pre-installed on every recent Mac.

In the terminal run:

shasum -a 256 filename/path

One scenario would be to include whatever you want in a textfile, then run the checksum function on the file and publicly publish the hash. At a later date you can then run a checksum function on the file which will output a value. You would then compare it to the previously stored checksum value. If it matches we can be relatively confident that the file has'nt been tampered with or altered.

You can either use your eyeballs and compare by sight the expected hash and the computed hash in the terminal or use shasum check command

echo 'your_expected_shasum_here_followed_by_a_space *name_of_file_to_check_after_asterisk' | shasum -c