{
    "mode": "perldoc",
    "parameter": "Dpkg::Checksums",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Dpkg%3A%3AChecksums/json",
    "generated": "2026-06-15T14:43:32Z",
    "sections": {
        "NAME": {
            "content": "Dpkg::Checksums - generate and manipulate file checksums\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module provides a class that can generate and manipulate various file checksums as well as\nsome methods to query information about supported checksums.\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "@list = checksumsgetlist()\nReturns the list of supported checksums algorithms.\n\n$bool = checksumsissupported($alg)\nReturns a boolean indicating whether the given checksum algorithm is supported. The checksum\nalgorithm is case-insensitive.\n\n$value = checksumsgetproperty($alg, $property)\nReturns the requested property of the checksum algorithm. Returns undef if either the\nproperty or the checksum algorithm doesn't exist. Valid properties currently include \"name\"\n(returns the name of the digest algorithm), \"regex\" for the regular expression describing\nthe common string representation of the checksum, and \"strong\" for a boolean describing\nwhether the checksum algorithm is considered cryptographically strong.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "$ck = Dpkg::Checksums->new()\nCreate a new Dpkg::Checksums object. This object is able to store the checksums of several\nfiles to later export them or verify them.\n\n$ck->reset()\nForget about all checksums stored. The object is again in the same state as if it was newly\ncreated.\n\n$ck->addfromfile($filename, %opts)\nAdd or verify checksums information for the file $filename. The file must exists for the\ncall to succeed. If you don't want the given filename to appear when you later export the\nchecksums you might want to set the \"key\" option with the public name that you want to use.\nAlso if you don't want to generate all the checksums, you can pass an array reference of the\nwanted checksums in the \"checksums\" option.\n\nIt the object already contains checksums information associated the filename (or key), it\nwill error out if the newly computed information does not match what's stored, and the\ncaller did not request that it be updated with the boolean \"update\" option.\n\n$ck->addfromstring($alg, $value, %opts)\nAdd checksums of type $alg that are stored in the $value variable. $value can be\nmulti-lines, each line should be a space separated list of checksum, file size and filename.\nLeading or trailing spaces are not allowed.\n\nIt the object already contains checksums information associated to the filenames, it will\nerror out if the newly read information does not match what's stored, and the caller did not\nrequest that it be updated with the boolean \"update\" option.\n\n$ck->addfromcontrol($control, %opts)\nRead checksums from Checksums-* fields stored in the Dpkg::Control object $control. It uses\n$self->addfromstring() on the field values to do the actual work.\n\nIf the option \"usefilesformd5\" evaluates to true, then the \"Files\" field is used in place\nof the \"Checksums-Md5\" field. By default the option is false.\n\n@files = $ck->getfiles()\nReturn the list of files whose checksums are stored in the object.\n\n$bool = $ck->hasfile($file)\nReturn true if we have checksums for the given file. Returns false otherwise.\n\n$ck->removefile($file)\nRemove all checksums of the given file.\n\n$checksum = $ck->getchecksum($file, $alg)\nReturn the checksum of type $alg for the requested $file. This will not compute the checksum\nbut only return the checksum stored in the object, if any.\n\nIf $alg is not defined, it returns a reference to a hash: keys are the checksum algorithms\nand values are the checksums themselves. The hash returned must not be modified, it's\ninternal to the object.\n\n$size = $ck->getsize($file)\nReturn the size of the requested file if it's available in the object.\n\n$bool = $ck->hasstrongchecksums($file)\nReturn a boolean on whether the file has a strong checksum.\n\n$ck->exporttostring($alg, %opts)\nReturn a multi-line string containing the checksums of type $alg. The string can be stored\nas-is in a Checksum-* field of a Dpkg::Control object.\n\n$ck->exporttocontrol($control, %opts)\nExport the checksums in the Checksums-* fields of the Dpkg::Control $control object.\n",
            "subsections": []
        },
        "CHANGES": {
            "content": "Version 1.04 (dpkg 1.20.0)\nRemove warning: For obsolete property 'program'.\n\nVersion 1.03 (dpkg 1.18.5)\nNew property: Add new 'strong' property.\n\nNew member: $ck->hasstrongchecksums().\n\nVersion 1.02 (dpkg 1.18.0)\nObsolete property: Getting the 'program' checksum property will warn and return undef, the\nDigest module is used internally now.\n\nNew property: Add new 'name' property with the name of the Digest algorithm to use.\n\nVersion 1.01 (dpkg 1.17.6)\nNew argument: Accept an options argument in $ck->exporttostring().\n\nNew option: Accept new option 'update' in $ck->addfromfile() and $ck->addfromcontrol().\n\nVersion 1.00 (dpkg 1.15.6)\nMark the module as public.\n",
            "subsections": []
        }
    },
    "summary": "Dpkg::Checksums - generate and manipulate file checksums",
    "flags": [],
    "examples": [],
    "see_also": []
}