Running shasum is often the quickest way to compute SHA message digests. The user simply feeds data to the script through files or standard input, and then collects the results from standard output.
If you want more info of the shasum check here the man page
Calculate MD5 checksum:
md5 /tmp/ubuntu.iso
Calculate SHA-1 checksum:
shasum -a 1 ubuntu.iso
Calculate SHA-256 checksum:
shasum -a 256 ubuntu.iso