259 lines
6.4 KiB
HTML
259 lines
6.4 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Dpkg::Checksums</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Dpkg::Checksums</H1>
|
|
Section: libdpkg-perl (3perl)<BR>Updated: 2020-03-23<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Dpkg::Checksums - generate and manipulate file checksums
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
This module provides an object that can generate and manipulate
|
|
various file checksums as well as some methods to query information
|
|
about supported checksums.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>FUNCTIONS</H2>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">@list = <B>checksums_get_list()</B><DD>
|
|
|
|
|
|
|
|
|
|
Returns the list of supported checksums algorithms.
|
|
<DT id="2">$bool = checksums_is_supported($alg)<DD>
|
|
|
|
|
|
|
|
|
|
Returns a boolean indicating whether the given checksum algorithm is
|
|
supported. The checksum algorithm is case-insensitive.
|
|
<DT id="3">$value = checksums_get_property($alg, $property)<DD>
|
|
|
|
|
|
|
|
|
|
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.
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>METHODS</H2>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="4">$ck = Dpkg::Checksums-><B>new()</B><DD>
|
|
|
|
|
|
|
|
|
|
Create a new Dpkg::Checksums object. This object is able to store
|
|
the checksums of several files to later export them or verify them.
|
|
<DT id="5">$ck-><B>reset()</B><DD>
|
|
|
|
|
|
|
|
|
|
Forget about all checksums stored. The object is again in the same state
|
|
as if it was newly created.
|
|
<DT id="6">$ck->add_from_file($filename, %opts)<DD>
|
|
|
|
|
|
|
|
|
|
Add or verify checksums information for the file <TT>$filename</TT>. The file must
|
|
exists 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.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
It the object already contains checksums information associated the
|
|
filename (or key), it will error out if the newly computed information
|
|
does not match what's stored, and the caller did not request that it be
|
|
updated with the boolean ``update'' option.
|
|
<DT id="7">$ck->add_from_string($alg, $value, %opts)<DD>
|
|
|
|
|
|
|
|
|
|
Add checksums of type <TT>$alg</TT> that are stored in the <TT>$value</TT> variable.
|
|
<TT>$value</TT> 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.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
It the object already contains checksums information associated to the
|
|
filenames, it will error out if the newly read information does not match
|
|
what's stored, and the caller did not request that it be updated with
|
|
the boolean ``update'' option.
|
|
<DT id="8">$ck->add_from_control($control, %opts)<DD>
|
|
|
|
|
|
|
|
|
|
Read checksums from Checksums-* fields stored in the Dpkg::Control object
|
|
<TT>$control</TT>. It uses <TT>$self</TT>-><B>add_from_string()</B> on the field values to do the
|
|
actual work.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
If the option ``use_files_for_md5'' evaluates to true, then the ``Files''
|
|
field is used in place of the ``Checksums-Md5'' field. By default the option
|
|
is false.
|
|
<DT id="9">@files = $ck-><B>get_files()</B><DD>
|
|
|
|
|
|
|
|
|
|
Return the list of files whose checksums are stored in the object.
|
|
<DT id="10">$bool = $ck->has_file($file)<DD>
|
|
|
|
|
|
|
|
|
|
Return true if we have checksums for the given file. Returns false
|
|
otherwise.
|
|
<DT id="11">$ck->remove_file($file)<DD>
|
|
|
|
|
|
|
|
|
|
Remove all checksums of the given file.
|
|
<DT id="12">$checksum = $ck->get_checksum($file, $alg)<DD>
|
|
|
|
|
|
|
|
|
|
Return the checksum of type <TT>$alg</TT> for the requested <TT>$file</TT>. This will not
|
|
compute the checksum but only return the checksum stored in the object, if
|
|
any.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
If <TT>$alg</TT> 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.
|
|
<DT id="13">$size = $ck->get_size($file)<DD>
|
|
|
|
|
|
|
|
|
|
Return the size of the requested file if it's available in the object.
|
|
<DT id="14">$bool = $ck->has_strong_checksums($file)<DD>
|
|
|
|
|
|
|
|
|
|
Return a boolean on whether the file has a strong checksum.
|
|
<DT id="15">$ck->export_to_string($alg, %opts)<DD>
|
|
|
|
|
|
|
|
|
|
Return a multi-line string containing the checksums of type <TT>$alg</TT>. The
|
|
string can be stored as-is in a Checksum-* field of a Dpkg::Control
|
|
object.
|
|
<DT id="16">$ck->export_to_control($control, %opts)<DD>
|
|
|
|
|
|
|
|
|
|
Export the checksums in the Checksums-* fields of the Dpkg::Control
|
|
<TT>$control</TT> object.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>CHANGES</H2>
|
|
|
|
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Version 1.03 (dpkg 1.18.5)</H3>
|
|
|
|
|
|
|
|
New property: Add new 'strong' property.
|
|
<P>
|
|
|
|
New member: <TT>$ck</TT>-><B>has_strong_checksums()</B>.
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Version 1.02 (dpkg 1.18.0)</H3>
|
|
|
|
|
|
|
|
Obsolete property: Getting the 'program' checksum property will warn and
|
|
return undef, the Digest module is used internally now.
|
|
<P>
|
|
|
|
New property: Add new 'name' property with the name of the Digest algorithm
|
|
to use.
|
|
<A NAME="lbAI"> </A>
|
|
<H3>Version 1.01 (dpkg 1.17.6)</H3>
|
|
|
|
|
|
|
|
New argument: Accept an options argument in <TT>$ck</TT>-><B>export_to_string()</B>.
|
|
<P>
|
|
|
|
New option: Accept new option 'update' in <TT>$ck</TT>-><B>add_from_file()</B> and
|
|
<TT>$ck</TT>-><B>add_from_control()</B>.
|
|
<A NAME="lbAJ"> </A>
|
|
<H3>Version 1.00 (dpkg 1.15.6)</H3>
|
|
|
|
|
|
|
|
Mark the module as public.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="17"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="18"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DT id="19"><A HREF="#lbAD">FUNCTIONS</A><DD>
|
|
<DT id="20"><A HREF="#lbAE">METHODS</A><DD>
|
|
<DT id="21"><A HREF="#lbAF">CHANGES</A><DD>
|
|
<DL>
|
|
<DT id="22"><A HREF="#lbAG">Version 1.03 (dpkg 1.18.5)</A><DD>
|
|
<DT id="23"><A HREF="#lbAH">Version 1.02 (dpkg 1.18.0)</A><DD>
|
|
<DT id="24"><A HREF="#lbAI">Version 1.01 (dpkg 1.17.6)</A><DD>
|
|
<DT id="25"><A HREF="#lbAJ">Version 1.00 (dpkg 1.15.6)</A><DD>
|
|
</DL>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:38 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|