Digest::file(3perl)

πŸ’– NAME πŸ’–

okay bestie, gather round β€” Digest::file β€” it calculates digests of files. that's the whole vibe. a lil module that looks at a file and gives you its fingerprint. no cap. ✨


🌸 SYNOPSIS 🌸

the classic. a poor man's "md5sum" command, but make it perl:

# Poor mans "md5sum" command
use Digest::file qw(digest_file_hex);
for (@ARGV) {
    print digest_file_hex($_, "MD5"), "  $_\n";
}

like, that's IT. that's the whole program. she ate. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so this module hands you 3 convenience functions to calculate the digest of files. three lil besties. here's the whole lineup:

  • digest_file( $file, $algorithm, [$arg,...] ) β€” she calculates and returns the binary digest of the bytes of the file you hand her. and if she can't open or read that file? she croaks. like, full-on. no silent failure, no vibes-based guessing, just a good honest croak. 😭

the $algorithm is a string, like "MD2", "MD5", "SHA-1", "SHA-512". and any extra arguments? those get passed straight to the constructor for whatever implementation backs the algorithm you picked. iykyk.

  • digest_file_hex( $file, $algorithm, [$arg,...] ) β€” literally the same as digest_file(), except she returns the digest in hex form. same energy, different outfit. πŸ’œ
  • digest_file_base64( $file, $algorithm, [$arg,...] ) β€” again, same as digest_file(), but this time the digest comes back as a base64 encoded string. iconic behavior honestly.

πŸŽ€ SEE ALSO πŸŽ€

  • Digest β€” go say hi, she's the whole family tree 🫢

ngl that's the entire module. short, sweet, does exactly one thing and does it well. main character energy fr fr. ⭐

mwah πŸ’‹ this was Digest::file(3perl) from the Perl Programmers Reference Guide, perl v5.44.0, dated 2026-10-17. slay, bye bestie!! πŸŒˆπŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ 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