QCryptographicHash露
- PyQt5.QtCore.QCryptographicHash
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 Algorithm enum for a list of the supported algorithms.
Enums露
- 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 macroQT_SHA3_KECCAK_COMPAT
.Member
Value
Description
Keccak_224 7
Generate a Keccak-224 hash sum. Introduced in Qt 5.9.2
Keccak_256 8
Generate a Keccak-256 hash sum. Introduced in Qt 5.9.2
Keccak_384 9
Generate a Keccak-384 hash sum. Introduced in Qt 5.9.2
Keccak_512 10
Generate a Keccak-512 hash sum. Introduced in Qt 5.9.2
Md4 0
Generate an MD4 hash sum
Md5 1
Generate an MD5 hash sum
Sha1 2
Generate an SHA-1 hash sum
Sha224 3
Generate an SHA-224 hash sum (SHA-2). Introduced in Qt 5.0
Sha256 4
Generate an SHA-256 hash sum (SHA-2). Introduced in Qt 5.0
Sha384 5
Generate an SHA-384 hash sum (SHA-2). Introduced in Qt 5.0
Sha3_224 RealSha3_224
Generate an SHA3-224 hash sum. Introduced in Qt 5.1
Sha3_256 RealSha3_256
Generate an SHA3-256 hash sum. Introduced in Qt 5.1
Sha3_384 RealSha3_384
Generate an SHA3-384 hash sum. Introduced in Qt 5.1
Sha3_512 RealSha3_512
Generate an SHA3-512 hash sum. Introduced in Qt 5.1
Sha512 6
Generate an SHA-512 hash sum (SHA-2). Introduced in Qt 5.0
Methods露
- __init__(Algorithm)
TODO
- addData(bytes)
Adds the first length chars of data to the cryptographic hash.
- addData(Union[QByteArray, bytes, bytearray])
This function overloads addData().
- addData(QIODevice) → bool
Reads the data from the open QIODevice device until it ends and hashes it. Returns
true
if reading was successful.
-
@staticmethod
hash(Union[QByteArray, bytes, bytearray], Algorithm) → QByteArray Returns the hash of data using method.
-
@staticmethod
hashLength(Algorithm) → int Returns the size of the output of the selected hash method in bytes.
- reset()
Resets the object.
- result() → QByteArray
Returns the final hash value.
See also