CopperSpice API  1.9.1
QCryptographicHash Class Reference

The QCryptographicHash class provides a way to generate cryptographic hashes. More...

Public Types

enum  Algorithm
 

Public Methods

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

Static Public Methods

static QByteArray hash (const QByteArray &data, Algorithm method)
 

Detailed Description

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

Refer to the documentation of the QCryptographicHash::Algorithm enum for a list of the supported algorithms.

See also
QByteArray::toHex()

Member Enumeration Documentation

This enum is used to specify which hash function is computed.

ConstantValueDescription
QCryptographicHash::Md40 Generate MD4 hash sum
QCryptographicHash::Md51 Generate MD5 hash sum
QCryptographicHash::Sha12 Generate SHA-1 hash sum
QCryptographicHash::Sha2243 Generate SHA-224 hash sum (SHA-2)
QCryptographicHash::Sha2564 Generate SHA-256 hash sum (SHA-2)
QCryptographicHash::Sha3845 Generate SHA-384 hash sum (SHA-2)
QCryptographicHash::Sha5126 Generate SHA-512 hash sum (SHA-2)
QCryptographicHash::Keccak_2247 Generate Keccak-224 hash sum
QCryptographicHash::Keccak_2568 Generate Keccak-256 hash sum
QCryptographicHash::Keccak_3849 Generate Keccak-384 hash sum
QCryptographicHash::Keccak_51210 Generate Keccak-512 hash sum
QCryptographicHash::Sha3_22411 Generate SHA-224 hash sum (SHA-3)
QCryptographicHash::Sha3_25612 Generate SHA-256 hash sum (SHA-3)
QCryptographicHash::Sha3_38413 Generate SHA-384 hash sum (SHA-3)
QCryptographicHash::Sha3_51214 Generate SHA-512 hash sum (SHA-3)

Constructor & Destructor Documentation

QCryptographicHash::QCryptographicHash ( Algorithm  method)
explicit

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

QCryptographicHash::~QCryptographicHash ( )

Destroys the object.

Method Documentation

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

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

void QCryptographicHash::addData ( const QByteArray data)

Adds the data to the cryptographic hash.

bool QCryptographicHash::addData ( QIODevice device)

Reads data from the open device until it ends and hashes it. Returns true if reading was successful.

QByteArray QCryptographicHash::hash ( const QByteArray data,
Algorithm  method 
)
static

Returns the hash of data using method.

void QCryptographicHash::reset ( )

Resets the object.

QByteArray QCryptographicHash::result ( ) const

Returns the final hash value.

See also
QByteArray::toHex()