Calculate checksum of an image

Synopsis

  md5sum [--set <setting>] <uri|image>...
  sha1sum [--set <setting>] <uri|image>...
  sha256sum [--set <setting>] <uri|image>...
  sha512sum [--set <setting>] <uri|image>...
  (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

Notes

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.

cmd/digest.txt ยท Last modified: 2025/08/06 13:43 by mcb30
Recent changes RSS feed CC Attribution-Share Alike 4.0 International Driven by DokuWiki
All uses of this content must include an attribution to the iPXE project and the URL https://ipxe.org
References to "iPXE" may not be altered or removed.