md5sum [--set <setting>] <uri|image>... sha1sum [--set <setting>] <uri|image>... sha256sum [--set <setting>] <uri|image>... sha512sum [--set <setting>] <uri|image>... (etc.)
imgfetch http://192.168.0.1/images/initrd.img sha256sum initrd.img
set expected:hexraw cb05def203386f2b33685d177d9f04e3e3d70dd4
imgfetch http://192.168.0.1/images/initrd.img
sha1sum --set actual initrd.img
iseq ${expected} ${actual} || goto checksum_bad
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..
| Success | The checksum was calculated (and optionally stored) successfully |
|---|---|
| Failure | The image could not be downloaded, or the checksum could not be stored |
You can use the 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 imgverify command.