![]() |
Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
|
#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) |
| typedef QCryptographicHash::Algorithm QxtHmac::Algorithm |
| QxtHmac::QxtHmac | ( | QCryptographicHash::Algorithm | algorithm | ) |
Constructs a QxtHmac object using the specified algorithm.
| void QxtHmac::addData | ( | const char * | data, |
| int | length ) |
Adds the provided data to the message to be authenticated.
| void QxtHmac::addData | ( | const QByteArray & | data | ) |
Adds the provided data to the message to be authenticated.
|
static |
Returns the HMAC of the provided data using the specified key and hashing algorithm.
| 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.
| void QxtHmac::reset | ( | ) |
Resets the object.
Any data that had been processed using addData() will be discarded. The key, if set, will be preserved.
| QByteArray QxtHmac::result | ( | ) |
Returns the authentication code for the message.
| 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.
|
static |
Verifies a HMAC against a known key and inner hash using the specified hashing algorithm.
| bool QxtHmac::verify | ( | const QByteArray & | otherInner | ) |
Verifies the authentication code against a known inner hash.