function h=sha256_file(path) fid=fopen(path,'rb');assert(fid>0);c=onCleanup(@()fclose(fid));bytes=fread(fid,Inf,'*uint8'); md=java.security.MessageDigest.getInstance('SHA-256');md.update(bytes); digest=typecast(md.digest(),'uint8');h=lower(reshape(dec2hex(digest,2)',1,[])); end