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. MD5 is a fast method to compute checksums, but 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.

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