Matlab file checksum

Computing file hash checksum allows some verification of file integrity, assuming the file is not maliciously altered to have the same checksum. While MD5 is a fast method to compute checksums, it is not cryptographically secure. That is, someone could create a malicious file with the same MD5 checksum as the desired file. A more secure checksum is SHA-256, which is slower to compute, but is considered adequate at the time of this writing.

We have created a Matlab function file_checksum that uses Java MessageDigest to compute the checksum of a file that is read in chunks to avoid overflowing the Java VM memory.