Dpkg::Checksums(3perl)

πŸ’– Dpkg::Checksums(3perl) β€” the libdpkg-perl glow-up πŸ’–

okay so bestie, listen. this is a Perl module from libdpkg-perl β€” like, it lives in the 3perl section, iykyk β€” and it is literally the whole entire vibe for generating and manipulating file checksums. ✨ ICONIC ✨


🌸 NAME 🌸

Dpkg::Checksums β€” generate and manipulate file checksums. that's it, that's the tweet. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so this module hands you a class that can generate and manipulate a whole bunch of file checksums, plus some extra little methods to go query info about which checksums are even supported. no cap, it's giving utility queen. πŸ‘‘


✨ FUNCTIONS ✨

  • @list = checksums_get_list() β€” returns the list of supported checksum algorithms. like a little roster of who's invited to the party πŸ’Œ
  • $bool = checksums_is_supported($alg) β€” returns a boolean telling you whether the given checksum algorithm is supported. and the checksum algorithm is case-insensitive, so don't stress about your caps lock, she doesn't care 🫢
  • $value = checksums_get_property($alg, $property) β€” returns the requested property of the checksum algorithm. returns undef if either the property or the checksum algorithm doesn't exist, rip 😭. valid properties currently include:
    • "name" β€” returns the name of the digest algorithm
    • "regex" β€” the regular expression describing the common string representation of the checksum
    • "strong" β€” a boolean describing whether the checksum algorithm is considered cryptographically strong πŸ’ͺ

πŸŽ€ METHODS πŸŽ€

  • $ck = Dpkg::Checksums->new() β€” create a new Dpkg::Checksums object. this object is able to store the checksums of several files so you can later export them or verify them. main character object energy, fr fr ✨
  • $ck->reset() β€” forget about all checksums stored. the object is again in the same state as if it was newly created. fresh start, new me, clean slate 🧚
  • $ck->add_from_file($filename, %opts) β€” add or verify checksums information for the file $filename. the file must exist for the call to succeed (no file, no dice, periodt). by default, if the $filename is known and the checksums do not match, the function will error out. πŸ’€

options:

  • key β€” set to the public name to use when exporting the checksums, instead of using $filename.
  • checksums β€” set an array reference with the list of wanted checksums to generate instead of generating all of them. picky picky, love that for her πŸ’…
  • update β€” set a boolean on whether the object should update the checksums information associated with the $filename (or key), instead of emitting an error if it does not match.
  • $ck->add_from_string($alg, $value, %opts) β€” add checksums of type $alg that are stored in the $value variable. $value can be multi-lines, each line should be a space separated list of checksum, file size and filename. and leading or trailing spaces are not allowed β€” she's strict about her whitespace bestie, respect it πŸ™ˆ

options:

  • update β€” set a boolean on whether the object should update the checksums information associated with the $filename (or key), instead of emitting an error if it does not match.
  • $ck->add_from_control($control, %opts) β€” read checksums from Checksums-* fields stored in the Dpkg::Control object $control. it uses $self->add_from_string() on the field values to do the actual work. the default field used is Checksums-Md5. πŸ“

options:

  • use_files_for_md5 β€” set to true to use the Files field instead of Checksums-Md5. defaults to false.
  • @files = $ck->get_files() β€” return the list of files whose checksums are stored in the object. roll call πŸ“£
  • $bool = $ck->has_file($file) β€” return true if we have checksums for the given file. returns false otherwise. simple as. βœ…
  • $ck->remove_file($file) β€” remove all checksums of the given file. bye bitch, blocking you, unfollowing 🚫 (affectionately)
  • $checksum = $ck->get_checksum($file, $alg) β€” return the checksum of type $alg for the requested $file. this will not compute the checksum but only return the checksum stored in the object, if any. she's not doing extra work for you, she's just reading what's already there πŸ’…

if $alg is not defined, it returns a reference to a hash: keys are the checksum algorithms and values are the checksums themselves. the hash returned must not be modified β€” it's internal to the object. do NOT touch, it's not yours, hands off πŸ™…β€β™€οΈ

  • $size = $ck->get_size($file) β€” return the size of the requested file if it's available in the object.
  • $bool = $ck->has_strong_checksums($file) β€” return a boolean on whether the file has a strong checksum. strong like bull πŸ’ͺπŸ”₯
  • $ck->export_to_string($alg, %opts) β€” return a multi-line string containing the checksums of type $alg. the string can be stored as-is in a Checksum-* field of a Dpkg::Control object. plug and play bestie πŸ”Œ
  • $ck->export_to_control($control, %opts) β€” export the checksums in the Checksums-* fields of the Dpkg::Control $control object. πŸŽ€

options:

  • use_files_for_md5 β€” set to true to use the Files field instead of Checksums-Md5. defaults to false.

πŸ“œ CHANGES πŸ“œ

πŸ•°οΈ Version 1.04 (dpkg 1.20.0)

  • Remove warning: for obsolete property 'program'. she said no more nagging, we're healing 🌈

πŸ•°οΈ Version 1.03 (dpkg 1.18.5)

  • New property: add new 'strong' property.
  • New member: $ck->has_strong_checksums().

πŸ•°οΈ Version 1.02 (dpkg 1.18.0)

  • Obsolete property: getting the 'program' checksum property will warn and return undef β€” the Digest module is used internally now. it's giving "we've moved on" πŸ’€
  • New property: add new 'name' property with the name of the Digest algorithm to use.

πŸ•°οΈ Version 1.01 (dpkg 1.17.6)

  • New argument: accept an options argument in $ck->export_to_string().
  • New option: accept new option 'update' in $ck->add_from_file() and $ck->add_from_control().

πŸ•°οΈ Version 1.00 (dpkg 1.15.6)

  • Mark the module as public. she's out, she's proud, she's public πŸ‘‘βœ¨

little sign-off moment: this icon was living her best life in version 1.23.11-dirty, dated 2026-09-09, and she's serving libdpkg-perl realness till the very last line. slay, stay hydrated, and always verify your checksums bestie πŸ«ΆπŸ’–πŸŽ€

πŸ“¦ where this page comes from