QCryptographicHash Class

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

Header: #include <QCryptographicHash>
Since: Qt 4.3

Note: All functions in this class are reentrant.

Public Types

enum Algorithm { Md4, Md5, Sha1 }

Public Functions

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

Static Public Members

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.

Currently MD4, MD5, and SHA-1 are supported.

Member Type Documentation

enum QCryptographicHash::Algorithm

QCryptographicHash::Md40Generate an MD4 hash sum
QCryptographicHash::Md51Generate an MD5 hash sum
QCryptographicHash::Sha12Generate an SHA1 hash sum

Member Function Documentation

QCryptographicHash::QCryptographicHash(Algorithm method)

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


Destroys the object.

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)

This function overloads addData().

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

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().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.