Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Poco::DigestEngine Class Referenceabstract

#include <DigestEngine.h>

Public Types

using Digest = std::vector<unsigned char>
 

Public Member Functions

 DigestEngine ()
 
virtual ~DigestEngine ()
 
void update (const void *data, std::size_t length)
 
void update (char data)
 
void update (const std::string &data)
 
virtual std::size_t digestLength () const =0
 Updates the digest with the given data.
 
virtual void reset ()=0
 Returns the length of the digest in bytes.
 
virtual const Digestdigest ()=0
 

Static Public Member Functions

static std::string digestToHex (const Digest &bytes)
 
static Digest digestFromHex (const std::string &digest)
 Converts a message digest into a string of hexadecimal numbers.
 
static bool constantTimeEquals (const Digest &d1, const Digest &d2)
 Converts a string created by digestToHex back to its Digest presentation.
 

Protected Member Functions

virtual void updateImpl (const void *data, std::size_t length)=0
 

Private Member Functions

 DigestEngine (const DigestEngine &)
 
DigestEngineoperator= (const DigestEngine &)
 

Detailed Description

This class is an abstract base class for all classes implementing a message digest algorithm, like MD5Engine and SHA1Engine. Call update() repeatedly with data to compute the digest from. When done, call digest() to obtain the message digest.

Definition at line 28 of file DigestEngine.h.

Member Typedef Documentation

◆ Digest

using Poco::DigestEngine::Digest = std::vector<unsigned char>

Definition at line 39 of file DigestEngine.h.

Constructor & Destructor Documentation

◆ DigestEngine() [1/2]

Poco::DigestEngine::DigestEngine ( )

◆ ~DigestEngine()

virtual Poco::DigestEngine::~DigestEngine ( )
virtual

◆ DigestEngine() [2/2]

Poco::DigestEngine::DigestEngine ( const DigestEngine & )
private

Updates the digest with the given data. Must be implemented by subclasses.

Member Function Documentation

◆ constantTimeEquals()

static bool Poco::DigestEngine::constantTimeEquals ( const Digest & d1,
const Digest & d2 )
static

Converts a string created by digestToHex back to its Digest presentation.

◆ digest()

virtual const Digest & Poco::DigestEngine::digest ( )
pure virtual

Resets the engine so that a new digest can be computed.

◆ digestFromHex()

static Digest Poco::DigestEngine::digestFromHex ( const std::string & digest)
static

Converts a message digest into a string of hexadecimal numbers.

◆ digestLength()

virtual std::size_t Poco::DigestEngine::digestLength ( ) const
pure virtual

Updates the digest with the given data.

◆ digestToHex()

static std::string Poco::DigestEngine::digestToHex ( const Digest & bytes)
static

Finishes the computation of the digest and returns the message digest. Resets the engine and can thus only be called once for every digest. The returned reference is valid until the next time digest() is called, or the engine object is destroyed.

◆ operator=()

DigestEngine & Poco::DigestEngine::operator= ( const DigestEngine & )
private

◆ reset()

virtual void Poco::DigestEngine::reset ( )
pure virtual

Returns the length of the digest in bytes.

◆ update() [1/3]

void Poco::DigestEngine::update ( char data)
inline

Definition at line 96 of file DigestEngine.h.

+ Here is the call graph for this function:

◆ update() [2/3]

void Poco::DigestEngine::update ( const std::string & data)
inline

Definition at line 102 of file DigestEngine.h.

+ Here is the call graph for this function:

◆ update() [3/3]

void Poco::DigestEngine::update ( const void * data,
std::size_t length )
inline

Definition at line 90 of file DigestEngine.h.

+ Here is the call graph for this function:

◆ updateImpl()

virtual void Poco::DigestEngine::updateImpl ( const void * data,
std::size_t length )
protectedpure virtual

Compares two Digest values using a constant-time comparison algorithm. This can be used to prevent timing attacks (as discussed in https://codahale.com/a-lesson-in-timing-attacks/).

+ Here is the caller graph for this function:

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