fn hash_file(path string) !string { mut file := os.open(path)! mut digest := sha256.new() io.cp(mut file, mut digest, buffer_size: 256 * 1024)! file.close() return digest.sum([]).hex() } fn main() { for fpath in os.args#[1..] { h := hash_file(fpath)! println...
possibility of changes (errors) is proportional to the size of the file; the possibility of errors increase as the file becomes larger. It is a very good idea to run an SHA-256 hash comparison check when you have a file like an operating system install CD that has to be 100% correct....
printf"sha256sum of the model file$filenameis not correct.\n" 242+ printf"Please remove the file then\n" 243+ printf"1) Manually download it from:$url\n" 244+ printf"or\n" 245+ printf"2) Ctrl+c to exit and restart this script\n" ...