QCryptographicHash Class
The QCryptographicHash class provides a way to generate cryptographic hashes. More...
Header: | #include <QCryptographicHash> |
qmake: | QT += core |
Since: | Qt 4.3 |
Note: All functions in this class are reentrant.
Public Types
enum | Algorithm { Md4, Md5, Sha1, Sha224, ..., Sha3_512 } |
Public Functions
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 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, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512 are supported.
Member Type Documentation
enum QCryptographicHash::Algorithm
Constant | Value | Description |
---|---|---|
QCryptographicHash::Md4 | 0 | Generate an MD4 hash sum |
QCryptographicHash::Md5 | 1 | Generate an MD5 hash sum |
QCryptographicHash::Sha1 | 2 | Generate an SHA-1 hash sum |
QCryptographicHash::Sha224 | 3 | Generate an SHA-224 hash sum (SHA-2). Introduced in Qt 5.0 |
QCryptographicHash::Sha256 | 4 | Generate an SHA-256 hash sum (SHA-2). Introduced in Qt 5.0 |
QCryptographicHash::Sha384 | 5 | Generate an SHA-384 hash sum (SHA-2). Introduced in Qt 5.0 |
QCryptographicHash::Sha512 | 6 | Generate an SHA-512 hash sum (SHA-2). Introduced in Qt 5.0 |
QCryptographicHash::Sha3_224 | 7 | Generate an SHA3-224 hash sum. Introduced in Qt 5.1 |
QCryptographicHash::Sha3_256 | 8 | Generate an SHA3-256 hash sum. Introduced in Qt 5.1 |
QCryptographicHash::Sha3_384 | 9 | Generate an SHA3-384 hash sum. Introduced in Qt 5.1 |
QCryptographicHash::Sha3_512 | 10 | Generate an SHA3-512 hash sum. Introduced in Qt 5.1 |
Member Function Documentation
QCryptographicHash::QCryptographicHash(Algorithm method)
Constructs an object that can be used to create a cryptographic hash from data using method.
QCryptographicHash::~QCryptographicHash()
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().
bool QCryptographicHash::addData(QIODevice *device)
Reads the data from the open QIODevice device until it ends and hashes it. Returns true
if reading was successful.
This function was introduced in Qt 5.0.
[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().
© 2017 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.