apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Hashes Class Reference

#include <hashes.h>

Collaboration diagram for Hashes:
[legend]

Public Types

enum  SupportedHashes { MD5SUM = (1 << 0) , SHA1SUM = (1 << 1) , SHA256SUM = (1 << 2) , SHA512SUM = (1 << 3) }
 

Public Member Functions

bool Add (const unsigned char *const Data, unsigned long long const Size) APT_NONNULL(2)
 
bool Add (const char *const Data) APT_NONNULL(2)
 
bool Add (const char *const Data, unsigned long long const Size) APT_NONNULL(2)
 
bool Add (const unsigned char *const Beg, const unsigned char *const End) APT_NONNULL(2
 
bool AddFD (int const Fd, unsigned long long Size=0)
 
bool AddFD (FileFd &Fd, unsigned long long Size=0)
 
HashStringList GetHashStringList ()
 
HashString GetHashString (SupportedHashes hash)
 
 Hashes ()
 
 Hashes (unsigned int const Hashes)
 
 Hashes (HashStringList const &Hashes)
 
virtual ~Hashes ()
 

Static Public Attributes

static const int UntilEOF = 0
 

Private Attributes

PrivateHashes *const d
 

Detailed Description

Definition at line 169 of file hashes.h.

Member Enumeration Documentation

◆ SupportedHashes

Enumerator
MD5SUM 
SHA1SUM 
SHA256SUM 
SHA512SUM 

Definition at line 185 of file hashes.h.

Constructor & Destructor Documentation

◆ Hashes() [1/3]

Hashes ( )

create a Hashes object to calculate all supported hashes

If ALL is too much, you can limit which Hashes are calculated with the following other constructors which mention explicitly which hashes to generate.

Definition at line 450 of file hashes.cc.

◆ Hashes() [2/3]

Hashes ( unsigned int const  Hashes)
explicit
Parameters
Hashesbitflag composed of SupportedHashes

Definition at line 451 of file hashes.cc.

◆ Hashes() [3/3]

Hashes ( HashStringList const &  Hashes)
explicit
Parameters
Hashesis a list of hashes

Definition at line 452 of file hashes.cc.

◆ ~Hashes()

~Hashes ( )
virtual

Definition at line 453 of file hashes.cc.

References d.

Member Function Documentation

◆ Add() [1/4]

bool Add ( const char *const  Data)
inline

Definition at line 176 of file hashes.h.

◆ Add() [2/4]

bool Add ( const char *const  Data,
unsigned long long const  Size 
)
inline

Definition at line 178 of file hashes.h.

◆ Add() [3/4]

bool Add ( const unsigned char *const  Beg,
const unsigned char *const  End 
)
inline

◆ Add() [4/4]

◆ AddFD() [1/2]

bool AddFD ( FileFd Fd,
unsigned long long  Size = 0 
)

Definition at line 381 of file hashes.cc.

References Add(), APT_BUFFER_SIZE, and FileFd::Read().

◆ AddFD() [2/2]

◆ GetHashString()

HashString GetHashString ( SupportedHashes  hash)

Get a specific hash. It is an error to use a hash that was not hashes

Definition at line 442 of file hashes.cc.

References Algorithms, d, PrivateHashes::hd, and HexDigest().

Referenced by MultiCompress::Child(), debListParser::Description_md5(), PackagesWriter::DoPackage(), HashString::GetHashForFile(), IdentCdrom(), and Sha1FromString().

◆ GetHashStringList()

Member Data Documentation

◆ d

PrivateHashes* const d
private

Definition at line 171 of file hashes.h.

Referenced by Add(), GetHashString(), GetHashStringList(), and ~Hashes().

◆ UntilEOF

const int UntilEOF = 0
static

Definition at line 173 of file hashes.h.

Referenced by AddFD().


The documentation for this class was generated from the following files: