calculates the hash of a file