The filesha512 function computes the SHA512 hash of the contents of a given file and encodes it as hex.