SHASUM(1perl)

πŸ“¦
version 5.44.0 Β· 2 versions
, in arch rolling

πŸ’… SHASUM πŸ’…

okay bestie, we're doing shasum today, which lives in the Perl Programmers Reference Guide and is genuinely one of the most useful little scripts ever. she prints or checks SHA checksums. that's it. that's the whole job. and she EATS. πŸ”₯


✨ NAME ✨

shasum β€” print or check SHA checksums. periodt. πŸ‘‘


🌸 SYNOPSIS 🌸

here's the whole vibe, verbatim, no edits:

Usage: shasum [OPTION]... [FILE]...
Print or check SHA checksums.
With no FILE, or when FILE is -, read standard input.

so like β€” you give her FILEs, or you give her nothing, or you hand her -, and either way she just reads standard input. a flexible icon fr fr. πŸ’–

πŸŽ€ the options πŸŽ€

  • -a, --algorithm β€” picks your algorithm. your choices are 1 (that's the default), 224, 256, 384, 512, 512224, 512256.
  • -b, --binary β€” read in binary mode.
  • -c, --check β€” reads SHA sums from the FILEs and checks them.
  • --tag β€” creates a BSD-style checksum.
  • -t, --text β€” read in text mode (also the default).
  • -U, --UNIVERSAL β€” read in Universal Newlines mode. the whole point is that it produces the same digest on Windows/Unix/Mac. cross-platform queen. 🌈
  • -0, --01 β€” read in BITS mode. so: ASCII '0' is interpreted as a 0-bit, ASCII '1' is interpreted as a 1-bit, and literally every other character is ignored. yes really. 😌

πŸ¦‹ verifying-only options πŸ¦‹

the following five options are only useful when you're verifying checksums β€” so like, if you're not checking, they're just standing there:

  • --ignore-missing β€” don't fail or report status for missing files. she simply will not be bothered. πŸ™ˆ
  • -q, --quiet β€” don't print OK for each successfully verified file. silent but slaying.
  • -s, --status β€” don't output anything at all; the status code shows success. no thoughts, just exit codes.
  • --strict β€” exit non-zero for improperly formatted checksum lines. she's strict, she has standards. πŸ’…
  • -w, --warn β€” warn about improperly formatted checksum lines. she's nice about it instead.

πŸ“ help & version πŸ“

  • -h, --help β€” display this help and exit.
  • -v, --version β€” output version information and exit.

when you're verifying SHA-512/224 or SHA-512/256 checksums, you gotta indicate the algorithm explicitly using the -a option, like this:

shasum -a 512224 -c checksumfile

the sums are computed as described in FIPS PUB 180-4. πŸ“œ and when you're checking, the input should be a former output of this program β€” like, a receipt she already gave you, not a random note from a stranger.

the default mode prints a line with:

  1. the checksum
  2. a character indicating the type β€” * for binary, a space for text, U for UNIVERSAL, ^ for BITS
  3. the name for each FILE

and here's the spicy part: the line starts with a \ character if the FILE name contains either newlines or backslashes, which then get replaced by the two-character sequences \n and \\ respectively. she protects her formatting at all costs. ✨

report shasum bugs to mshelor@cpan.org πŸ›

πŸ’œ DESCRIPTION πŸ’œ

running shasum is often the quickest way to compute SHA message digests. that's the entire pitch. you simply feed data to the script through files or standard input, and then collect the results from standard output. chef's kiss. πŸ‘‘

here's how you compute digests for typical inputs β€” like the NIST test vector "abc":

perl -e "print qq(abc)" | shasum

or, if you wanna use SHA-256 instead of the default SHA-1, simply say:

perl -e "print qq(abc)" | shasum -a 256

so shasum mimics the behavior of the combined GNU sha1sum, sha224sum, sha256sum, sha384sum, and sha512sum programs β€” meaning you can install this script as a convenient drop-in replacement. bestie is literally five programs in a trench coat. πŸ§šπŸ’–

BUT β€” unlike the GNU programs, shasum encompasses the full SHA standard by allowing partial-byte inputs. how, you ask? through the BITS option, -0. iconic behavior. so here's the example that computes the SHA-224 digest of the 7-bit message 0001100:

perl -e "print qq(0001100)" | shasum -0 -a 224

like. seven bits. who else is doing it like her. 😭πŸ”₯


🌟 AUTHOR 🌟

Copyright (C) 2003-2023 Mark Shelor <mshelor@cpan.org>.


πŸ‘‘ SEE ALSO πŸ‘‘

shasum is implemented using the Perl module Digest::SHA. go check her out, iykyk. πŸ’«


okay that's the whole page, no notes. 🫢

this was perl v5.44.0, dated 2026-10-17, and you found it under SHASUM(1perl). mwah. πŸ’‹βœ¨

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms