Skip to content

QCryptoHash

Riccardo edited this page Sep 22, 2018 · 8 revisions

The QCryptoHash class provides a way to generate cryptographic hashes. It can be used to generate cryptographic hashes of binary or text data.

Currently Tiger-192, RipeMD-160 and Whirlpool are supported.

#include "qcryptohash.hpp"

List of all members

Public Types

Type Name
enum Algorithm { TIGER, RMD160, WHIRLPOOL }

Public Members

Return type Name
QCryptoHash( Algorithm method )
~QCryptoHash()
void reset()
void addData( const char *data, int length )
void addData( const QByteArray &data )
bool addData( QIODevice *device )
QByteArray result() const

Static Public Members

Return type Name
QByteArray hash( const QByteArray &data, Algorithm method )

Member Type Documentation

enum Algorithm

The Algorithm enum specifies the hashing algorithms supported by QCryptoHash.

Constant Value Description
QCryptoHash::TIGER 0 Generate a Tiger-192 hash sum.
QCryptoHash::RMD160 1 Generate a RipeMD-160 hash sum.
QCryptoHash::WHIRLPOOL 2 Generate a Whirlpool hash sum.

Member Function Documentation

Constructs an object that can be used to create a cryptographic hash from data using method.


Destroys the object.


void QCryptoHash::reset()

Resets the object.


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

Adds the first length chars of data to the cryptographic hash.


void QCryptoHash::addData( const QByteArray &data )

Adds the bytes of data to the cryptographic hash.


bool QCryptoHash::addData( QIODevice *device )

Reads the data from the open QIODevice device until it ends and hashes it.

Returns true if reading was successful.


QByteArray QCryptoHash::result() const

Returns the final hash value.


[static] QByteArray QCryptoHash::hash( const QByteArray &data, Algorithm method )

Returns the hash of data using method.