Dpkg::Checksums - generate and manipulate file checksums
| Use Case | Command | Description |
|---|---|---|
| Create a checksums object | $ck = Dpkg::Checksums->new() | Initialise a fresh handler |
| Add checksums from a file | $ck->add_from_file($filename) | Compute and store checksums for a file |
| Add checksums from a string | $ck->add_from_string($alg, $value) | Parse and store checksum data |
| Export to a control object | $ck->export_to_control($control) | Write Checksums-* fields into a Dpkg::Control object |
| Export to a string | $ck->export_to_string($alg) | Generate a multiβline checksum string |
| Get a specific checksum | $ck->get_checksum($file, $alg) | Retrieve the stored checksum for a file |
| List supported algorithms | checksums_get_list() | Return all known checksum types |
This module provides a class that can generate and manipulate various file checksums as well as some methods to query information about supported checksums.
@list = checksums_get_list() β π Returns the list of supported checksums algorithms.$bool = checksums_is_supported($alg) β β
Returns a boolean indicating whether the given checksum algorithm is supported. The checksum algorithm is caseβinsensitive.$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. Valid properties currently include "name" (returns the name of the digest algorithm), "regex" for the regular expression describing the common string representation of the checksum, and "strong" for a boolean describing whether the checksum algorithm is considered cryptographically strong.$ck = Dpkg::Checksums->new() β π Create a new Dpkg::Checksums object. This object is able to store the checksums of several files to later export them or verify them.$ck->reset() β π Forget about all checksums stored. The object is again in the same state as if it was newly created.$ck->add_from_file($filename, %opts) β π₯ Add or verify checksums information for the file $filename. The file must exist for the call to succeed. If you don't want the given filename to appear when you later export the checksums you might want to set the "key" option with the public name that you want to use. Also if you don't want to generate all the checksums, you can pass an array reference of the wanted checksums in the "checksums" option.$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. Leading or trailing spaces are not allowed.$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.@files = $ck->get_files() β π Return the list of files whose checksums are stored in the object.$bool = $ck->has_file($file) β β Return true if we have checksums for the given file. Returns false otherwise.$ck->remove_file($file) β ποΈ Remove all checksums of the given file.$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.$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.$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.$ck->export_to_control($control, %opts) β π¦ Export the checksums in the Checksums-* fields of the Dpkg::Control $control object.Remove warning: For obsolete property 'program'.
New property: Add new 'strong' property.
New member: $ck->has_strong_checksums().
Obsolete property: Getting the 'program' checksum property will warn and return undef, the Digest module is used internally now.
New property: Add new 'name' property with the name of the Digest algorithm to use.
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().
Mark the module as public.
1.21.1 2025-09-09 Dpkg::Checksums(3perl)
Generated by phpman v4.9.25-3-gdbaf087 Author: Che Dong Under GNU General Public License
2026-07-06 23:13 @216.73.217.93
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-pro / taotoken.net / www.chedong.com - original format