Digest::file(3pm)

🌸 NAME 🌸

Bestie, welcome to Digest::file(3pm) from the Perl Programmers Reference Guide β€” this module is literally here to Calculate digests of files. Periodt. πŸ’…


✨ SYNOPSIS ✨

Here’s the iconic β€œpoor man’s md5sum” moment, copied exactly so you can slay it yourself:

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

πŸŽ€ DESCRIPTION πŸŽ€

This module provides 3 convenience functions to calculate the digest of files. The following functions are provided:

πŸ’– digest_file( $file, $algorithm, [$arg,...] )

This function will calculate and return the binary digest of the bytes of the given file. The function will croak if it fails to open or read the file. 😭

The $algorithm is a string like "MD2", "MD5", "SHA-1", "SHA-512". Additional arguments are passed to the constructor for the implementation of the given algorithm. 🫢

πŸ¦‹ digest_file_hex( $file, $algorithm, [$arg,...] )

Same as digest_file(), but return the digest in hex form. ✨

🌈 digest_file_base64( $file, $algorithm, [$arg,...] )

Same as digest_file(), but return the digest as a base64 encoded string. πŸŽ€


πŸ”₯ SEE ALSO πŸ”₯

Digest


okay bye bestie πŸ’… β€” this page is from perl v5.42.3, dated 2026-11-03, and it’s the Digest::file(3pm) manual page. mwah 🫢

πŸ“¦ where this page comes from