QCryptographicHash Class

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

Header: #include <QCryptographicHash>
qmake: QT += core
Since: Qt 4.3

This class was introduced in Qt 4.3.

Note: All functions in this class are reentrant.

Public Types

enum Algorithm { Md4, Md5, Sha1, Sha224, Sha256, …, Keccak_512 }

Detailed Description

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.

Member Type Documentation

enum QCryptographicHash::Algorithm

Note: In Qt versions before 5.9, when asked to generate a SHA3 hash sum, QCryptographicHash actually calculated Keccak. If you need compatibility with SHA-3 hashes produced by those versions of Qt, use the Keccak_ enumerators. Alternatively, if source compatibility is required, define the macro QT_SHA3_KECCAK_COMPAT.

ConstantValueDescription
QCryptographicHash::Md40Generate an MD4 hash sum
QCryptographicHash::Md51Generate an MD5 hash sum
QCryptographicHash::Sha12Generate an SHA-1 hash sum
QCryptographicHash::Sha2243Generate an SHA-224 hash sum (SHA-2). Introduced in Qt 5.0
QCryptographicHash::Sha2564Generate an SHA-256 hash sum (SHA-2). Introduced in Qt 5.0
QCryptographicHash::Sha3845Generate an SHA-384 hash sum (SHA-2). Introduced in Qt 5.0
QCryptographicHash::Sha5126Generate an SHA-512 hash sum (SHA-2). Introduced in Qt 5.0
QCryptographicHash::Sha3_224RealSha3_224Generate an SHA3-224 hash sum. Introduced in Qt 5.1
QCryptographicHash::Sha3_256RealSha3_256Generate an SHA3-256 hash sum. Introduced in Qt 5.1
QCryptographicHash::Sha3_384RealSha3_384Generate an SHA3-384 hash sum. Introduced in Qt 5.1
QCryptographicHash::Sha3_512RealSha3_512Generate an SHA3-512 hash sum. Introduced in Qt 5.1
QCryptographicHash::Keccak_2247Generate a Keccak-224 hash sum. Introduced in Qt 5.9.2
QCryptographicHash::Keccak_2568Generate a Keccak-256 hash sum. Introduced in Qt 5.9.2
QCryptographicHash::Keccak_3849Generate a Keccak-384 hash sum. Introduced in Qt 5.9.2
QCryptographicHash::Keccak_51210Generate a Keccak-512 hash sum. Introduced in Qt 5.9.2