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 asdigest_file(), except she returns the digest in hex form. same energy, different outfit. πdigest_file_base64( $file, $algorithm, [$arg,...] )β again, same asdigest_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