PySide6.QtCore.QCryptographicHash¶
- class QCryptographicHash¶
- The - QCryptographicHashclass provides a way to generate cryptographic hashes. More…- Synopsis¶- Methods¶- def - __init__()
- def - addData()
- def - algorithm()
- def - reset()
- def - result()
- def - resultView()
- def - swap()
 - Static functions¶- def - hash()
- def - hashLength()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- QCryptographicHashcan be used to generate cryptographic hashes of binary or text data.- Refer to the documentation of the - Algorithmenum for a list of the supported algorithms.- class Algorithm¶
- Note - In Qt versions before 5.9, when asked to generate a SHA3 hash sum, - QCryptographicHashactually 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.- Constant - Description - QCryptographicHash.Md4 - Generate an MD4 hash sum - QCryptographicHash.Md5 - Generate an MD5 hash sum - QCryptographicHash.Sha1 - Generate an SHA-1 hash sum - QCryptographicHash.Sha224 - Generate an SHA-224 hash sum (SHA-2). Introduced in Qt 5.0 - QCryptographicHash.Sha256 - Generate an SHA-256 hash sum (SHA-2). Introduced in Qt 5.0 - QCryptographicHash.Sha384 - Generate an SHA-384 hash sum (SHA-2). Introduced in Qt 5.0 - QCryptographicHash.Sha512 - Generate an SHA-512 hash sum (SHA-2). Introduced in Qt 5.0 - QCryptographicHash.Sha3_224 - Generate an SHA3-224 hash sum. Introduced in Qt 5.1 - QCryptographicHash.Sha3_256 - Generate an SHA3-256 hash sum. Introduced in Qt 5.1 - QCryptographicHash.Sha3_384 - Generate an SHA3-384 hash sum. Introduced in Qt 5.1 - QCryptographicHash.Sha3_512 - Generate an SHA3-512 hash sum. Introduced in Qt 5.1 - QCryptographicHash.Keccak_224 - Generate a Keccak-224 hash sum. Introduced in Qt 5.9.2 - QCryptographicHash.Keccak_256 - Generate a Keccak-256 hash sum. Introduced in Qt 5.9.2 - QCryptographicHash.Keccak_384 - Generate a Keccak-384 hash sum. Introduced in Qt 5.9.2 - QCryptographicHash.Keccak_512 - Generate a Keccak-512 hash sum. Introduced in Qt 5.9.2 - QCryptographicHash.Blake2b_160 - Generate a BLAKE2b-160 hash sum. Introduced in Qt 6.0 - QCryptographicHash.Blake2b_256 - Generate a BLAKE2b-256 hash sum. Introduced in Qt 6.0 - QCryptographicHash.Blake2b_384 - Generate a BLAKE2b-384 hash sum. Introduced in Qt 6.0 - QCryptographicHash.Blake2b_512 - Generate a BLAKE2b-512 hash sum. Introduced in Qt 6.0 - QCryptographicHash.Blake2s_128 - Generate a BLAKE2s-128 hash sum. Introduced in Qt 6.0 - QCryptographicHash.Blake2s_160 - Generate a BLAKE2s-160 hash sum. Introduced in Qt 6.0 - QCryptographicHash.Blake2s_224 - Generate a BLAKE2s-224 hash sum. Introduced in Qt 6.0 - QCryptographicHash.Blake2s_256 - Generate a BLAKE2s-256 hash sum. Introduced in Qt 6.0 
 - Constructs an object that can be used to create a cryptographic hash from data using - method.- addData(data)¶
- Parameters:
- data – - QByteArrayView
 
 - Adds the characters in - bytesto the cryptographic hash.- Note - In Qt versions prior to 6.3, this function took - QByteArray, not- QByteArrayView.- addData(device)
- Parameters:
- device – - QIODevice
- Return type:
- bool 
 
 - Reads the data from the open - QIODevice- deviceuntil it ends and hashes it. Returns- trueif reading was successful.- addData(data)
- Parameters:
- data – str 
 - Note - This function is deprecated. 
 - Adds the first - lengthchars of- datato the cryptographic hash.- Use the - QByteArrayViewoverload instead.- Returns the algorithm used to generate the cryptographic hash. - Returns the hash of - datausing- method.- Note - In Qt versions prior to 6.3, this function took - QByteArray, not- QByteArrayView.- See also - hashInto()- Returns the size of the output of the selected hash - methodin bytes.- reset()¶
 - Resets the object. - result()¶
- Return type:
 
 - Returns the final hash value. - See also - resultView()¶
- Return type:
- QByteArrayView
 
 - Returns the final hash value. - Note that the returned view remains valid only as long as the - QCryptographicHashobject is not modified by other means.- See also - Returns whether the selected algorithm - methodis supported and if- result()will return a value when the- methodis used.- Note - OpenSSL will be responsible for providing this information when used as a provider, otherwise - truewill be returned as the non-OpenSSL implementation doesn’t have any restrictions. We return- falseif we fail to query OpenSSL.- swap(other)¶
- Parameters:
- other – - QCryptographicHash
 
 - Swaps this cryptographic hash with - other. This operation is very fast and never fails.