Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
QxtHmac Class Reference

#include <qxthmac.h>

Public Types

typedef QCryptographicHash::Algorithm Algorithm

Public Member Functions

 QxtHmac (QCryptographicHash::Algorithm algorithm)
void setKey (QByteArray key)
void reset ()
void addData (const char *data, int length)
void addData (const QByteArray &data)
QByteArray innerHash () const
QByteArray result ()
bool verify (const QByteArray &otherInner)

Static Public Member Functions

static QByteArray hash (const QByteArray &key, const QByteArray &data, Algorithm algorithm)
static bool verify (const QByteArray &key, const QByteArray &hmac, const QByteArray &inner, Algorithm algorithm)

Member Typedef Documentation

◆ Algorithm

typedef QCryptographicHash::Algorithm QxtHmac::Algorithm

Constructor & Destructor Documentation

◆ QxtHmac()

QxtHmac::QxtHmac ( QCryptographicHash::Algorithm algorithm)

Constructs a QxtHmac object using the specified algorithm.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ addData() [1/2]

void QxtHmac::addData ( const char * data,
int length )

Adds the provided data to the message to be authenticated.

Here is the caller graph for this function:

◆ addData() [2/2]

void QxtHmac::addData ( const QByteArray & data)

Adds the provided data to the message to be authenticated.

Here is the call graph for this function:

◆ hash()

QByteArray QxtHmac::hash ( const QByteArray & key,
const QByteArray & data,
Algorithm algorithm )
static

Returns the HMAC of the provided data using the specified key and hashing algorithm.

Here is the call graph for this function:

◆ innerHash()

QByteArray QxtHmac::innerHash ( ) const

Returns the inner hash of the HMAC function.

This hash can be stored in lieu of the shared secret on the authenticating side and used for verifying an HMAC code. When used in this manner, HMAC can be used to provide a form of secure password authentication. See the documentation above for details.

Here is the caller graph for this function:

◆ reset()

void QxtHmac::reset ( )

Resets the object.

Any data that had been processed using addData() will be discarded. The key, if set, will be preserved.

Here is the caller graph for this function:

◆ result()

QByteArray QxtHmac::result ( )

Returns the authentication code for the message.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setKey()

void QxtHmac::setKey ( QByteArray key)

Sets the shared secret key for the message authentication code.

Any data that had been processed using addData() will be discarded.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ verify() [1/2]

bool QxtHmac::verify ( const QByteArray & key,
const QByteArray & hmac,
const QByteArray & inner,
Algorithm algorithm )
static

Verifies a HMAC against a known key and inner hash using the specified hashing algorithm.

Here is the call graph for this function:

◆ verify() [2/2]

bool QxtHmac::verify ( const QByteArray & otherInner)

Verifies the authentication code against a known inner hash.

See also
innerHash()
Here is the call graph for this function:

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