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. returnsundefif 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 newDpkg::Checksumsobject. 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$filenameis 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$algthat are stored in the$valuevariable.$valuecan 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 fromChecksums-*fields stored in theDpkg::Controlobject$control. it uses$self->add_from_string()on the field values to do the actual work. the default field used isChecksums-Md5. π
options:
use_files_for_md5β set to true to use theFilesfield instead ofChecksums-Md5. defaults tofalse.
@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$algfor 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 aChecksum-*field of aDpkg::Controlobject. plug and play bestie π$ck->export_to_control($control, %opts)β export the checksums in theChecksums-*fields of theDpkg::Control$controlobject. π
options:
use_files_for_md5β set to true to use theFilesfield instead ofChecksums-Md5. defaults tofalse.
π 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 returnundefβ 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
- arch rolling: dpkg 1.23.11-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms