====== Calculate checksum of an image ====== ===== Synopsis ===== md5sum [--set ] ... sha1sum [--set ] ... sha256sum [--set ] ... sha512sum [--set ] ... (etc.) ===== Examples ===== === Download an image and show its SHA-256 checksum === imgfetch http://192.168.0.1/images/initrd.img sha256sum initrd.img === Download and verify the SHA-1 checksum of an image === set expected:hexraw cb05def203386f2b33685d177d9f04e3e3d70dd4 imgfetch http://192.168.0.1/images/initrd.img sha1sum --set actual initrd.img iseq ${expected} ${actual} || goto checksum_bad ===== Description ===== Calculate the checksum of one or more images using the specified cryptographic hash algorithm. If a setting is specified using the ''%%--set%%'' option then the checksum will be stored in the setting, otherwise the checksum will be displayed along with the image name.. ===== Command status ===== ^ Success | The checksum was calculated (and optionally stored) successfully | ^ Failure | The image could not be downloaded, or the checksum could not be stored | ===== See also ===== * ''[[:cmd:show]]'' * ''[[:cmd:iseq]]'' * ''[[:cmd:imgtrust]]'' * ''[[:cmd:imgverify]]'' * [[:cmd|List of all iPXE commands]] ===== Notes ===== You can use the ''[[:cmd:iseq]]'' command to compare the calculated checksum with an expected value. For example: sha1sum --set cksum initrd.img echo SHA-1 checksum is ${cksum} iseq ${cksum} 2dedcc5025938a67bbfd4cfbd924dceda7302b1a || goto failed You can use this type of comparison as a sanity check to verify that you have downloaded the images that you were expecting to download. You cannot use this type of comparison to mark the images as trusted by iPXE: the only way to mark an image as trusted is to use the ''[[:cmd:imgverify]]'' command.