NCBI C++ ToolKit
Classes | Enumerations | Enumerator | Functions | Variables
Checksum
+ Collaboration diagram for Checksum:

Classes

class  CChecksumBase
 CChecksumBase – Base class with auxiliary methods for CHash and CChecksum. More...
 
class  CHash
 CHash – Hash calculator. More...
 
class  NHash
 NHash –. More...
 
class  CChecksum
 CChecksum – Checksum calculator. More...
 
class  CChecksumException
 CChecksumException –. More...
 
class  CChecksumStreamWriter
 CChecksumStreamWriter –. More...
 
class  CMD5
 

Enumerations

enum  CChecksumBase::EMethodDef {
  CChecksumBase::eNone , CChecksumBase::eCRC32 , CChecksumBase::eCRC32ZIP , CChecksumBase::eCRC32INSD ,
  CChecksumBase::eCRC32CKSUM , CChecksumBase::eCRC32C , CChecksumBase::eAdler32 , CChecksumBase::eMD5 ,
  CChecksumBase::eCityHash32 , CChecksumBase::eCityHash64 , CChecksumBase::eFarmHash32 , CChecksumBase::eFarmHash64 ,
  CChecksumBase::eMurmurHash2_32 , CChecksumBase::eMurmurHash2_64 , CChecksumBase::eMurmurHash3_32
}
 All supported methods for CHash and CCheksum. More...
 
enum  CHash::EMethod {
  CHash::eCRC32 = CChecksumBase::eCRC32C , CHash::eCRC32ZIP = CChecksumBase::eCRC32ZIP , CHash::eCRC32INSD = CChecksumBase::eCRC32INSD , CHash::eCRC32CKSUM = CChecksumBase::eCRC32CKSUM ,
  CHash::eCRC32C = CChecksumBase::eCRC32C , CHash::eAdler32 = CChecksumBase::eAdler32 , CHash::eCityHash32 = CChecksumBase::eCityHash32 , CHash::eCityHash64 = CChecksumBase::eCityHash64 ,
  CHash::eFarmHash32 = CChecksumBase::eFarmHash32 , CHash::eFarmHash64 = CChecksumBase::eFarmHash64 , CHash::eMurmurHash2_32 = CChecksumBase::eMurmurHash2_32 , CHash::eMurmurHash2_64 = CChecksumBase::eMurmurHash2_64 ,
  CHash::eMurmurHash3_32 = CChecksumBase::eMurmurHash3_32 , CHash::eDefault = eCityHash64
}
 Method used to compute hash. More...
 
enum  CChecksum::EMethod {
  CChecksum::eCRC32 = CChecksumBase::eCRC32 , CChecksum::eCRC32ZIP = CChecksumBase::eCRC32ZIP , CChecksum::eCRC32INSD = CChecksumBase::eCRC32INSD , CChecksum::eCRC32CKSUM = CChecksumBase::eCRC32CKSUM ,
  CChecksum::eCRC32C = CChecksumBase::eCRC32C , CChecksum::eAdler32 = CChecksumBase::eAdler32 , CChecksum::eMD5 = CChecksumBase::eMD5 , CChecksum::eDefault = eCRC32
}
 Method used to compute control sum. More...
 
enum  { CChecksum::kMinimumChecksumLength = 20 }
 
enum  CChecksumException::EErrCode { CChecksumException::eStreamIO , CChecksumException::eFileIO }
 Error types that can be generated. More...
 
enum  { CMD5::kBlockSize = 64 }
 

Functions

 CChecksumBase::CChecksumBase (EMethodDef method)
 Default constructor. More...
 
 CChecksumBase::~CChecksumBase ()
 Destructor. More...
 
 CChecksumBase::CChecksumBase (const CChecksumBase &other)
 Copy constructor. More...
 
CChecksumBaseCChecksumBase::operator= (const CChecksumBase &other)
 Assignment operator. More...
 
size_t CChecksumBase::GetSize (void) const
 Return size of checksum/hash in bytes, depending on used method. More...
 
size_t CChecksumBase::GetBits (void) const
 Return size of checksum/hash in bits (32, 64). More...
 
Uint4 CChecksumBase::GetResult32 (void) const
 Return calculated result. More...
 
Uint8 CChecksumBase::GetResult64 (void) const
 Return calculated result. More...
 
string CChecksumBase::GetResultHex (void) const
 Return string with checksum/hash in hexadecimal form. More...
 
static void CChecksumBase::InitTables (void)
 Initialize static tables used in CRC32 calculation. More...
 
static void CChecksumBase::PrintTables (CNcbiOstream &out)
 Print C++ code for CRC32 tables for direct inclusion into library. More...
 
EMethodDef CChecksumBase::x_GetMethod (void) const
 
void CChecksumBase::x_Update (const char *str, size_t len)
 Update current control sum with data provided. More...
 
void CChecksumBase::x_Reset (EMethodDef method)
 Reset the object to prepare it to the next computation using selected method. More...
 
void CChecksumBase::x_Free (void)
 Cleanup (used in destructor and assignment operator). More...
 
 CHash::CHash (EMethod method=eDefault)
 Default constructor. More...
 
 CHash::CHash (const CHash &other)
 Copy constructor. More...
 
CHashCHash::operator= (const CHash &other)
 Assignment operator. More...
 
EMethod CHash::GetMethod (void) const
 Get current method used to compute hash. More...
 
static void CHash::SetSeed (Uint8 seed)
 Unique seed used by some hash methods. More...
 
void CHash::Calculate (const CTempString str)
 Calculate hash. More...
 
void CHash::Calculate (const char *str, size_t len)
 
static void CHash::Calculate (const CTempString str, EMethod method, Uint4 &hash)
 Static methods for simplified one line calculations. More...
 
static void CHash::Calculate (const CTempString str, EMethod method, Uint8 &hash)
 
static void CHash::Calculate (const char *str, size_t len, EMethod method, Uint4 &hash)
 
static void CHash::Calculate (const char *str, size_t len, EMethod method, Uint8 &hash)
 
void CHash::Reset (EMethod method)
 Reset the object to prepare it to the next computation using another method. More...
 
static Uint4 NHash::CityHash32 (const CTempString str)
 CityHash. More...
 
static Uint4 NHash::CityHash32 (const char *str, size_t len)
 
static Uint8 NHash::CityHash64 (const CTempString str)
 
static Uint8 NHash::CityHash64 (const char *str, size_t len)
 
static Uint4 NHash::FarmHash32 (const CTempString str)
 FarmHash. More...
 
static Uint4 NHash::FarmHash32 (const char *str, size_t len)
 
static Uint8 NHash::FarmHash64 (const CTempString str)
 
static Uint8 NHash::FarmHash64 (const char *str, size_t len)
 
static Uint4 NHash::MurmurHash2 (const CTempString str, Uint4 seed=0)
 MurmurHash2. More...
 
static Uint4 NHash::MurmurHash2 (const char *str, size_t len, Uint4 seed=0)
 
static Uint8 NHash::MurmurHash64A (const CTempString str, Uint8 seed=0)
 
static Uint8 NHash::MurmurHash64A (const char *str, size_t len, Uint8 seed=0)
 
static Uint4 NHash::MurmurHash3_x86_32 (const CTempString str, Uint4 seed=0)
 MurmurHash3 (32-bit version only) More...
 
static Uint4 NHash::MurmurHash3_x86_32 (const char *str, size_t len, Uint4 seed=0)
 
 CChecksum::CChecksum (EMethod method=eDefault)
 Default constructor. More...
 
 CChecksum::CChecksum (const CChecksum &other)
 Copy constructor. More...
 
CChecksumCChecksum::operator= (const CChecksum &other)
 Assignment operator. More...
 
EMethod CChecksum::GetMethod (void) const
 Get current method used to compute checksum. More...
 
size_t CChecksum::GetChecksumSize (void) const
 Return size of checksum in bytes. More...
 
Uint4 CChecksum::GetChecksum (void) const
 Return calculated checksum. More...
 
void CChecksum::GetMD5Digest (unsigned char digest[16]) const
 Return calculated MD5 digest. More...
 
void CChecksum::GetMD5Digest (string &str) const
 
string CChecksum::GetHexSum (void) const
 Return string with checksum in hexadecimal form. More...
 
void CChecksum::AddChars (const char *str, size_t len)
 Update current control sum with data provided. More...
 
void CChecksum::AddLine (const char *line, size_t len)
 
void CChecksum::AddLine (const string &line)
 
void CChecksum::NextLine (void)
 
void CChecksum::AddFile (const string &file_path)
 Update checksum with the file data. More...
 
void CChecksum::AddStream (CNcbiIstream &is)
 Update checksum with the stream data. More...
 
void CChecksum::Reset (void)
 Reset the object to prepare it to the next checksum computation with the same method. More...
 
void CChecksum::Reset (EMethod method)
 Reset the object to prepare it to the next checksum computation with different method. More...
 
bool CChecksum::ValidChecksumLine (const char *line, size_t len) const
 Check for checksum line. More...
 
bool CChecksum::ValidChecksumLine (const string &line) const
 
CNcbiOstreamCChecksum::WriteChecksum (CNcbiOstream &out) const
 Write checksum calculation results into output stream. More...
 
CNcbiOstreamCChecksum::WriteChecksumData (CNcbiOstream &out) const
 
CNcbiOstreamCChecksum::WriteHexSum (CNcbiOstream &out) const
 
bool CChecksum::ValidChecksumLineLong (const char *line, size_t len) const
 Check for checksum line. More...
 
CNcbiOstreamoperator<< (CNcbiOstream &out, const CChecksum &checksum)
 Write checksum calculation results into output stream. More...
 
NCBI_XUTIL_EXPORT CChecksum ComputeFileChecksum (const string &path, CChecksum::EMethod method)
 Compute checksum for the given file. More...
 
NCBI_XUTIL_EXPORT CChecksumComputeFileChecksum (const string &path, CChecksum &checksum)
 Computes checksum for the given file. More...
 
NCBI_XUTIL_EXPORT Uint4 ComputeFileCRC32 (const string &path)
 Compute CRC32 checksum for the given file. More...
 
virtual const char * CChecksumException::GetErrCodeString (void) const override
 Translate from an error code value to its string representation. More...
 
 CChecksumException::NCBI_EXCEPTION_DEFAULT (CChecksumException, CCoreException)
 
 CChecksumStreamWriter::CChecksumStreamWriter (CChecksum::EMethod method)
 Construct object to compute checksum for written data. More...
 
virtual CChecksumStreamWriter::~CChecksumStreamWriter (void)
 
virtual ERW_Result CChecksumStreamWriter::Write (const void *buf, size_t count, size_t *bytes_written=0)
 Virtual methods from IWriter. More...
 
virtual ERW_Result CChecksumStreamWriter::Flush (void)
 Flush pending data (if any) down to the output device. More...
 
const CChecksumCChecksumStreamWriter::GetChecksum (void) const
 Return checksum. More...
 
 CMD5::CMD5 (void)
 
void CMD5::Update (const char *buf, size_t length)
 
void CMD5::Finalize (unsigned char digest[16])
 
string CMD5::GetHexSum (void)
 
static string CMD5::GetHexSum (unsigned char digest[16])
 
void CMD5::Transform (void)
 

Variables

EMethodDef CChecksumBase::m_Method
 Current method. More...
 
size_t CChecksumBase::m_CharCount
 Number of processed chars. More...
 
static Uint8 CChecksumBase::m_Seed = 0
 Unique seed used by some hash methods. More...
 
Uint4   CChecksumBase::v32
 Used to store 32-bit results. More...
 
Uint8   CChecksumBase::v64
 Used to store 64-bit results. More...
 
CMD5 *   CChecksumBase::md5
 Used for MD5 calculation. More...
 
union {
   Uint4   CChecksumBase::v32
 Used to store 32-bit results. More...
 
   Uint8   CChecksumBase::v64
 Used to store 64-bit results. More...
 
   CMD5 *   CChecksumBase::md5
 Used for MD5 calculation. More...
 
CChecksumBase::m_Value
 Checksum/Hash computation result. More...
 
size_t CChecksum::m_LineCount
 Number of processed lines. More...
 
CChecksum CChecksumStreamWriter::m_Checksum
 Checksum calculator. More...
 
Uint4 CMD5::m_Buf [4]
 
Int8 CMD5::m_Bits
 
unsigned char CMD5::m_In [kBlockSize]
 
bool CMD5::m_Finalized
 

Detailed Description

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kMinimumChecksumLength 

Definition at line 316 of file checksum.hpp.

◆ anonymous enum

anonymous enum
protected
Enumerator
kBlockSize 

Definition at line 57 of file md5.hpp.

◆ EErrCode

Error types that can be generated.

Enumerator
eStreamIO 
eFileIO 

Definition at line 433 of file checksum.hpp.

◆ EMethod [1/2]

Method used to compute hash.

See also
CChecksumBase::EMethods
Enumerator
eCRC32 
eCRC32ZIP 
eCRC32INSD 
eCRC32CKSUM 
eCRC32C 
eAdler32 
eCityHash32 
eCityHash64 
eFarmHash32 
eFarmHash64 
eMurmurHash2_32 
eMurmurHash2_64 
eMurmurHash3_32 
eDefault 

Definition at line 199 of file checksum.hpp.

◆ EMethod [2/2]

Method used to compute control sum.

See also
CChecksumBase::EMethods
Enumerator
eCRC32 
eCRC32ZIP 
eCRC32INSD 
eCRC32CKSUM 
eCRC32C 
eAdler32 
eMD5 
eDefault 

Definition at line 306 of file checksum.hpp.

◆ EMethodDef

enum CChecksumBase::EMethodDef
protected

All supported methods for CHash and CCheksum.

Enumerator
eNone 

Undefined (for internal use).

eCRC32 

32-bit Cyclic Redundancy Check.

Most significant bit first, no inversions.

eCRC32ZIP 

Exact zip CRC32.

Same polynomial as eCRC32. Least significant bit are processed first, extra inversions at the beginning and the end.

eCRC32INSD 

Inverted CRC32ZIP.

Hash function used in the ID system to verify sequence uniqueness.

eCRC32CKSUM 

CRC32 implemented by cksum utility.

Same as eCRC32, but with data length included in CRC, and extra inversion at the end.

eCRC32C 

CRC32C (Castagnoli).

Better polynomial used in some places (iSCSI). This method has hardware support in new Intel processors. Least significant bits are processed first, extra inversions at the beginning and the end.

eAdler32 

A bit faster than CRC32ZIP, not recommended for small data sizes.

eMD5 

Message Digest version 5.

eCityHash32 

CityHash, 32-bit result.

Attention
You should not use CityHash for persistent storage. CityHash does not maintain backward compatibility with previous versions.
eCityHash64 

CityHash, 64-bit result.

eFarmHash32 

FarmHash, 32-bit result.

Attention
You should not use FarmHash for persistent storage. Both FarmHash 32/64-bit methods may change from time to time, may differ on different platforms or compiler flags.
eFarmHash64 

FarmHash, 64-bit result.

eMurmurHash2_32 

MurmurHash2 for x86, 32-bit result.

Attention
You should not use MurmurHash for persistent storage. It may produce different results depends on platforms, depending on little-endian or big-endian architectures, 32- or 64-bit, or compiler options related to alignment.
eMurmurHash2_64 

MurmurHash2 for x64, 64-bit result.

eMurmurHash3_32 

MurmurHash3 for x86, 32-bit result.

Definition at line 58 of file checksum.hpp.

Function Documentation

◆ AddChars()

void CChecksum::AddChars ( const char *  str,
size_t  len 
)
inline

◆ AddFile()

void CChecksum::AddFile ( const string file_path)

Update checksum with the file data.

On error an exception will be thrown, and the checksum not change.

Definition at line 373 of file checksum.cpp.

References buf, CFileIO_Base::eOpen, CFileIO_Base::eRead, f(), n, NCBI_RETHROW, and tmp.

Referenced by CLDS2_UrlHandler_File::GetFileCRC(), NS_GetConfigFileChecksum(), NST_GetConfigFileChecksum(), and s_GetCheckSumForFile().

◆ AddLine() [1/2]

void CChecksum::AddLine ( const char *  line,
size_t  len 
)
inline

◆ AddLine() [2/2]

void CChecksum::AddLine ( const string line)
inline

Definition at line 616 of file checksum.hpp.

References CChecksum::AddLine().

◆ AddStream()

void CChecksum::AddStream ( CNcbiIstream is)

Update checksum with the stream data.

On error an exception will be thrown, and the checksum not change.

Parameters
isInput stream to read data from. Please use ios_base::binary flag for the input stream if you want to count all symbols there, including end of lines.

Definition at line 395 of file checksum.cpp.

References buf, n, NCBI_THROW, and tmp.

◆ Calculate() [1/6]

void CHash::Calculate ( const char *  str,
size_t  len 
)
inline

Definition at line 577 of file checksum.hpp.

References CChecksumBase::m_CharCount, str(), and CChecksumBase::x_Update().

◆ Calculate() [2/6]

void CHash::Calculate ( const char *  str,
size_t  len,
EMethod  method,
Uint4 hash 
)
static

Definition at line 263 of file checksum.cpp.

References CHash::Calculate(), CChecksumBase::GetResult32(), len, and str().

◆ Calculate() [3/6]

void CHash::Calculate ( const char *  str,
size_t  len,
EMethod  method,
Uint8 hash 
)
static

Definition at line 271 of file checksum.cpp.

References CHash::Calculate(), CChecksumBase::GetResult64(), len, and str().

◆ Calculate() [4/6]

void CHash::Calculate ( const CTempString  str)
inline

Calculate hash.

See also
GetResult32(), GetResult66()

Definition at line 570 of file checksum.hpp.

References CChecksumBase::m_CharCount, str(), and CChecksumBase::x_Update().

Referenced by CHash::Calculate().

◆ Calculate() [5/6]

void CHash::Calculate ( const CTempString  str,
EMethod  method,
Uint4 hash 
)
static

Static methods for simplified one line calculations.

Definition at line 247 of file checksum.cpp.

References CHash::Calculate(), CChecksumBase::GetResult32(), and str().

◆ Calculate() [6/6]

void CHash::Calculate ( const CTempString  str,
EMethod  method,
Uint8 hash 
)
static

Definition at line 255 of file checksum.cpp.

References CHash::Calculate(), CChecksumBase::GetResult64(), and str().

◆ CChecksum() [1/2]

CChecksum::CChecksum ( const CChecksum other)

Copy constructor.

Definition at line 286 of file checksum.cpp.

◆ CChecksum() [2/2]

CChecksum::CChecksum ( EMethod  method = eDefault)

Default constructor.

Definition at line 279 of file checksum.cpp.

◆ CChecksumBase() [1/2]

CChecksumBase::CChecksumBase ( const CChecksumBase other)

◆ CChecksumBase() [2/2]

CChecksumBase::CChecksumBase ( EMethodDef  method)

Default constructor.

Definition at line 109 of file checksum.cpp.

References CChecksumBase::x_Reset().

◆ CChecksumStreamWriter()

CChecksumStreamWriter::CChecksumStreamWriter ( CChecksum::EMethod  method)

Construct object to compute checksum for written data.

Definition at line 1337 of file checksum.cpp.

◆ CHash() [1/2]

CHash::CHash ( const CHash other)

Copy constructor.

Definition at line 224 of file checksum.cpp.

◆ CHash() [2/2]

CHash::CHash ( EMethod  method = eDefault)

Default constructor.

Definition at line 218 of file checksum.cpp.

◆ CityHash32() [1/2]

Uint4 NHash::CityHash32 ( const char *  str,
size_t  len 
)
static

Definition at line 1239 of file checksum.cpp.

References CityHash32(), len, and str().

◆ CityHash32() [2/2]

Uint4 NHash::CityHash32 ( const CTempString  str)
static

CityHash.

Definition at line 1234 of file checksum.cpp.

References CityHash32(), and str().

◆ CityHash64() [1/2]

Uint8 NHash::CityHash64 ( const char *  str,
size_t  len 
)
static

Definition at line 1249 of file checksum.cpp.

References CityHash64(), len, and str().

◆ CityHash64() [2/2]

Uint8 NHash::CityHash64 ( const CTempString  str)
static

Definition at line 1244 of file checksum.cpp.

References CityHash64(), and str().

Referenced by GetIdHash().

◆ CMD5()

CMD5::CMD5 ( void  )

Definition at line 58 of file md5.cpp.

References CMD5::m_Buf.

◆ ComputeFileChecksum() [1/2]

NCBI_XUTIL_EXPORT CChecksum& ComputeFileChecksum ( const string path,
CChecksum checksum 
)

Computes checksum for the given file.

Deprecated:
Please use CChecksum::AddFile() method instead.

Definition at line 450 of file checksum.cpp.

References ComputeFileChecksum_deprecated().

◆ ComputeFileChecksum() [2/2]

NCBI_XUTIL_EXPORT CChecksum ComputeFileChecksum ( const string path,
CChecksum::EMethod  method 
)

Compute checksum for the given file.

Deprecated:
Please use CChecksum::AddFile() method instead.

Definition at line 443 of file checksum.cpp.

References ComputeFileChecksum_deprecated().

◆ ComputeFileCRC32()

NCBI_XUTIL_EXPORT Uint4 ComputeFileCRC32 ( const string path)

Compute CRC32 checksum for the given file.

Deprecated:
Please use CChecksum::AddFile() method instead.

Definition at line 456 of file checksum.cpp.

References ComputeFileChecksum_deprecated(), CChecksum::eCRC32, and CChecksum::GetChecksum().

◆ FarmHash32() [1/2]

Uint4 NHash::FarmHash32 ( const char *  str,
size_t  len 
)
static

Definition at line 1260 of file checksum.cpp.

References util::Hash32(), len, and str().

◆ FarmHash32() [2/2]

Uint4 NHash::FarmHash32 ( const CTempString  str)
static

FarmHash.

Definition at line 1254 of file checksum.cpp.

References util::Hash32(), and str().

◆ FarmHash64() [1/2]

Uint8 NHash::FarmHash64 ( const char *  str,
size_t  len 
)
static

Definition at line 1270 of file checksum.cpp.

References util::Hash64(), len, and str().

◆ FarmHash64() [2/2]

Uint8 NHash::FarmHash64 ( const CTempString  str)
static

Definition at line 1265 of file checksum.cpp.

References util::Hash64(), and str().

◆ Finalize()

void CMD5::Finalize ( unsigned char  digest[16])

Definition at line 118 of file md5.cpp.

References int, CMD5::kBlockSize, CMD5::m_Bits, CMD5::m_Buf, CMD5::m_Finalized, CMD5::m_In, and CMD5::Transform().

Referenced by CMD5::GetHexSum().

◆ Flush()

ERW_Result CChecksumStreamWriter::Flush ( void  )
virtual

Flush pending data (if any) down to the output device.

Implements IWriter.

Definition at line 1359 of file checksum.cpp.

References eRW_Success.

◆ GetBits()

size_t CChecksumBase::GetBits ( void  ) const
inline

Return size of checksum/hash in bits (32, 64).

See also
GetSize

Definition at line 496 of file checksum.hpp.

References CChecksumBase::GetSize().

Referenced by CChecksumBase::GetResultHex().

◆ GetChecksum() [1/2]

Uint4 CChecksum::GetChecksum ( void  ) const
inline

◆ GetChecksum() [2/2]

const CChecksum & CChecksumStreamWriter::GetChecksum ( void  ) const
inline

Return checksum.

Definition at line 660 of file checksum.hpp.

References CChecksumStreamWriter::m_Checksum.

Referenced by s_EquivalentExts().

◆ GetChecksumSize()

size_t CChecksum::GetChecksumSize ( void  ) const
inline

Return size of checksum in bytes.

Use this name for backward compatibility.

See also
GetSize()

Definition at line 333 of file checksum.hpp.

References CChecksumBase::GetSize().

◆ GetErrCodeString()

const char * CChecksumException::GetErrCodeString ( void  ) const
overridevirtual

Translate from an error code value to its string representation.

Reimplemented from CCoreException.

Definition at line 1322 of file checksum.cpp.

References CChecksumException::eFileIO, CChecksumException::eStreamIO, CCoreException::GetErrCode(), and CException::GetErrCodeString().

◆ GetHexSum() [1/3]

string CMD5::GetHexSum ( unsigned char  digest[16])
static

Definition at line 172 of file md5.cpp.

References hex(), i, and int.

◆ GetHexSum() [2/3]

string CMD5::GetHexSum ( void  )
inline

Definition at line 73 of file md5.hpp.

References CMD5::Finalize().

◆ GetHexSum() [3/3]

string CChecksum::GetHexSum ( void  ) const
inline

◆ GetMD5Digest() [1/2]

void CChecksum::GetMD5Digest ( string str) const
inline

◆ GetMD5Digest() [2/2]

void CChecksum::GetMD5Digest ( unsigned char  digest[16]) const
inline

◆ GetMethod() [1/2]

CHash::EMethod CHash::GetMethod ( void  ) const
inline

Get current method used to compute hash.

Definition at line 502 of file checksum.hpp.

References CChecksumBase::m_Method.

◆ GetMethod() [2/2]

CChecksum::EMethod CChecksum::GetMethod ( void  ) const
inline

Get current method used to compute checksum.

Definition at line 508 of file checksum.hpp.

References CChecksumBase::m_Method.

Referenced by CChecksum::GetMD5Digest(), CChecksum::WriteChecksumData(), and CChecksum::WriteHexSum().

◆ GetResult32()

Uint4 CChecksumBase::GetResult32 ( void  ) const
inline

◆ GetResult64()

Uint8 CChecksumBase::GetResult64 ( void  ) const
inline

Return calculated result.

Attention
Only valid in 64-bit modes, like: CityHash64, FarmHash64.

Definition at line 547 of file checksum.hpp.

References _ASSERT, CChecksumBase::eCityHash64, CChecksumBase::eFarmHash64, CChecksumBase::eMurmurHash2_64, CChecksumBase::m_Method, and CChecksumBase::m_Value.

Referenced by CHash::Calculate(), and CChecksumBase::GetResultHex().

◆ GetResultHex()

string CChecksumBase::GetResultHex ( void  ) const

◆ GetSize()

size_t CChecksumBase::GetSize ( void  ) const
inline

Return size of checksum/hash in bytes, depending on used method.

See also
GetMethod, GetBits

Definition at line 481 of file checksum.hpp.

References CChecksumBase::eCityHash64, CChecksumBase::eFarmHash64, CChecksumBase::eMD5, CChecksumBase::eMurmurHash2_64, and CChecksumBase::m_Method.

Referenced by CChecksumBase::GetBits(), and CChecksum::GetChecksumSize().

◆ InitTables()

void CChecksumBase::InitTables ( void  )
static

Initialize static tables used in CRC32 calculation.

There is no need to call this method since it's done internally when necessary.

Definition at line 463 of file checksum.cpp.

References s_InitTableCRC32CReverse(), s_InitTableCRC32Forward(), and s_InitTableCRC32Reverse().

Referenced by CPubseqGatewayApp::CPubseqGatewayApp(), and CChecksumBase::PrintTables().

◆ MurmurHash2() [1/2]

Uint4 NHash::MurmurHash2 ( const char *  str,
size_t  len,
Uint4  seed = 0 
)
static

Definition at line 1281 of file checksum.cpp.

References _ASSERT, kMax_Int, len, MurmurHash2(), seed, and str().

◆ MurmurHash2() [2/2]

Uint4 NHash::MurmurHash2 ( const CTempString  str,
Uint4  seed = 0 
)
static

MurmurHash2.

Note
The length of string is limited with int type.

Definition at line 1275 of file checksum.cpp.

References _ASSERT, kMax_Int, MurmurHash2(), seed, and str().

◆ MurmurHash3_x86_32() [1/2]

Uint4 NHash::MurmurHash3_x86_32 ( const char *  str,
size_t  len,
Uint4  seed = 0 
)
static

Definition at line 1307 of file checksum.cpp.

References _ASSERT, kMax_Int, len, NHash::MurmurHash3_x86_32(), result, seed, and str().

◆ MurmurHash3_x86_32() [2/2]

Uint4 NHash::MurmurHash3_x86_32 ( const CTempString  str,
Uint4  seed = 0 
)
static

MurmurHash3 (32-bit version only)

Note
The length of string is limited with int type. MurmurHash2 for x64, 64-bit result.

Definition at line 1299 of file checksum.cpp.

References _ASSERT, kMax_Int, result, seed, and str().

Referenced by NHash::MurmurHash3_x86_32().

◆ MurmurHash64A() [1/2]

Uint8 NHash::MurmurHash64A ( const char *  str,
size_t  len,
Uint8  seed = 0 
)
static

Definition at line 1293 of file checksum.cpp.

References _ASSERT, kMax_Int, len, MurmurHash64A(), seed, and str().

◆ MurmurHash64A() [2/2]

Uint8 NHash::MurmurHash64A ( const CTempString  str,
Uint8  seed = 0 
)
static

Definition at line 1287 of file checksum.cpp.

References _ASSERT, kMax_Int, MurmurHash64A(), seed, and str().

◆ NCBI_EXCEPTION_DEFAULT()

CChecksumException::NCBI_EXCEPTION_DEFAULT ( CChecksumException  ,
CCoreException   
)

◆ NextLine()

void CChecksum::NextLine ( void  )

◆ operator<<()

CNcbiOstream& operator<< ( CNcbiOstream out,
const CChecksum checksum 
)

Write checksum calculation results into output stream.

Definition at line 654 of file checksum.hpp.

References out(), and CChecksum::WriteChecksum().

◆ operator=() [1/3]

CChecksum & CChecksum::operator= ( const CChecksum other)

Assignment operator.

Definition at line 293 of file checksum.cpp.

References CChecksum::m_LineCount, and CChecksumBase::operator=().

◆ operator=() [2/3]

CChecksumBase & CChecksumBase::operator= ( const CChecksumBase other)

◆ operator=() [3/3]

CHash & CHash::operator= ( const CHash other)

Assignment operator.

Definition at line 230 of file checksum.cpp.

References CChecksumBase::operator=().

◆ PrintTables()

void CChecksumBase::PrintTables ( CNcbiOstream out)
static

Print C++ code for CRC32 tables for direct inclusion into library.

Such inclusion eliminates the need to initialize CRC32 tables.

Definition at line 1150 of file checksum.cpp.

References CChecksumBase::InitTables(), out(), s_CRC32CTableReverse, s_CRC32TableForward, s_CRC32TableReverse, and s_PrintTable().

◆ Reset() [1/3]

void CHash::Reset ( EMethod  method)
inline

Reset the object to prepare it to the next computation using another method.

Definition at line 584 of file checksum.hpp.

References CChecksumBase::x_Reset().

◆ Reset() [2/3]

void CChecksum::Reset ( EMethod  method)
inline

Reset the object to prepare it to the next checksum computation with different method.

Definition at line 590 of file checksum.hpp.

References CChecksumBase::x_Reset().

◆ Reset() [3/3]

void CChecksum::Reset ( void  )
inline

Reset the object to prepare it to the next checksum computation with the same method.

Definition at line 596 of file checksum.hpp.

References CChecksumBase::m_Method, and CChecksumBase::x_Reset().

◆ SetSeed()

void CHash::SetSeed ( Uint8  seed)
static

Unique seed used by some hash methods.

Usually this value sets once per process if needed. 0 by default, if not specified.

Definition at line 241 of file checksum.cpp.

References CChecksumBase::m_Seed, and seed.

◆ Transform()

void CMD5::Transform ( void  )
private

Definition at line 198 of file md5.cpp.

References a, b, F1, F2, F3, F4, CMD5::m_Buf, CMD5::m_In, and MD5STEP.

Referenced by CMD5::Finalize(), and CMD5::Update().

◆ Update()

void CMD5::Update ( const char *  buf,
size_t  length 
)

◆ ValidChecksumLine() [1/2]

bool CChecksum::ValidChecksumLine ( const char *  line,
size_t  len 
) const
inline

◆ ValidChecksumLine() [2/2]

bool CChecksum::ValidChecksumLine ( const string line) const
inline

Definition at line 631 of file checksum.hpp.

References CChecksum::ValidChecksumLine().

◆ ValidChecksumLineLong()

bool CChecksum::ValidChecksumLineLong ( const char *  line,
size_t  len 
) const
private

Check for checksum line.

Definition at line 314 of file checksum.cpp.

References buffer, len, and CChecksum::WriteChecksum().

Referenced by CChecksum::ValidChecksumLine().

◆ Write()

ERW_Result CChecksumStreamWriter::Write ( const void *  buf,
size_t  count,
size_t *  bytes_written = 0 
)
virtual

Virtual methods from IWriter.

Implements IWriter.

Definition at line 1348 of file checksum.cpp.

References CChecksum::AddChars(), buf, eRW_Success, and CChecksumStreamWriter::m_Checksum.

◆ WriteChecksum()

CNcbiOstream & CChecksum::WriteChecksum ( CNcbiOstream out) const

Write checksum calculation results into output stream.

Definition at line 301 of file checksum.cpp.

References CChecksumBase::m_CharCount, CChecksum::m_LineCount, out(), sx_CharCount, sx_End, sx_LineCount, sx_Start, and CChecksum::WriteChecksumData().

Referenced by operator<<(), and CChecksum::ValidChecksumLineLong().

◆ WriteChecksumData()

CNcbiOstream & CChecksum::WriteChecksumData ( CNcbiOstream out) const

◆ WriteHexSum()

CNcbiOstream & CChecksum::WriteHexSum ( CNcbiOstream out) const

◆ x_Free()

void CChecksumBase::x_Free ( void  )
inlineprotected

Cleanup (used in destructor and assignment operator).

Definition at line 561 of file checksum.hpp.

References CChecksumBase::eMD5, CChecksumBase::m_Method, CChecksumBase::m_Value, and NULL.

Referenced by CChecksumBase::operator=(), CChecksumBase::x_Reset(), and CChecksumBase::~CChecksumBase().

◆ x_GetMethod()

EMethodDef CChecksumBase::x_GetMethod ( void  ) const
inline

Definition at line 139 of file checksum.hpp.

References CChecksumBase::m_Method.

◆ x_Reset()

void CChecksumBase::x_Reset ( EMethodDef  method)
protected

◆ x_Update()

void CChecksumBase::x_Update ( const char *  str,
size_t  len 
)
protected

◆ ~CChecksumBase()

CChecksumBase::~CChecksumBase ( )

Destructor.

Definition at line 116 of file checksum.cpp.

References CChecksumBase::x_Free().

◆ ~CChecksumStreamWriter()

CChecksumStreamWriter::~CChecksumStreamWriter ( void  )
virtual

Definition at line 1343 of file checksum.cpp.

Variable Documentation

◆ m_Bits

Int8 CMD5::m_Bits
private

Definition at line 66 of file md5.hpp.

Referenced by CMD5::Finalize(), and CMD5::Update().

◆ m_Buf

Uint4 CMD5::m_Buf[4]
private

Definition at line 65 of file md5.hpp.

Referenced by CMD5::CMD5(), CMD5::Finalize(), and CMD5::Transform().

◆ m_CharCount

size_t CChecksumBase::m_CharCount
protected

◆ m_Checksum

CChecksum CChecksumStreamWriter::m_Checksum
private

Checksum calculator.

Definition at line 468 of file checksum.hpp.

Referenced by CChecksumStreamWriter::GetChecksum(), and CChecksumStreamWriter::Write().

◆ m_Finalized

bool CMD5::m_Finalized
private

Definition at line 68 of file md5.hpp.

Referenced by CMD5::Finalize(), and CMD5::Update().

◆ m_In

unsigned char CMD5::m_In[kBlockSize]
private

Definition at line 67 of file md5.hpp.

Referenced by CMD5::Finalize(), CMD5::Transform(), and CMD5::Update().

◆ m_LineCount

size_t CChecksum::m_LineCount
private

Number of processed lines.

Definition at line 390 of file checksum.hpp.

Referenced by CChecksum::NextLine(), CChecksum::operator=(), and CChecksum::WriteChecksum().

◆ m_Method

EMethodDef CChecksumBase::m_Method
protected

◆ m_Seed

Uint8 CChecksumBase::m_Seed = 0
staticprotected

Unique seed used by some hash methods.

Usually this value sets once per process if needed. 0 by default, if not specified.

See also
CHash::SetSeed()
CHash::SetSeed()

Definition at line 150 of file checksum.hpp.

Referenced by CHash::SetSeed(), and CChecksumBase::x_Update().

◆ 

union { ... } CChecksumBase::m_Value

◆ md5 [1/2]

CMD5* CChecksumBase::md5

Used for MD5 calculation.

Definition at line 156 of file checksum.hpp.

Referenced by CChecksumBase::CChecksumBase(), and CChecksumBase::operator=().

◆  [2/2]

CMD5* { ... } ::md5

Used for MD5 calculation.

Definition at line 156 of file checksum.hpp.

◆  [1/2]

Uint4 { ... } ::v32

Used to store 32-bit results.

Definition at line 154 of file checksum.hpp.

◆ v32 [2/2]

Uint4 CChecksumBase::v32

Used to store 32-bit results.

Definition at line 154 of file checksum.hpp.

Referenced by CChecksumBase::GetResult32().

◆ v64 [1/2]

Uint8 CChecksumBase::v64

Used to store 64-bit results.

Definition at line 155 of file checksum.hpp.

Referenced by CChecksumBase::CChecksumBase(), and CChecksumBase::operator=().

◆  [2/2]

Uint8 { ... } ::v64

Used to store 64-bit results.

Definition at line 155 of file checksum.hpp.

Modified on Tue Apr 30 06:43:01 2024 by modify_doxy.py rev. 669887