QPasswordDigestor¶
The QPasswordDigestor namespace contains functions which you can use to generate hashes or keys. More…
New in version 5.12.
Synopsis¶
Static functions¶
def
deriveKeyPbkdf1
(algorithm, password, salt, iterations, dkLen)def
deriveKeyPbkdf2
(algorithm, password, salt, iterations, dkLen)
Detailed Description¶
- static PySide2.QtNetwork.QPasswordDigestor.deriveKeyPbkdf1(algorithm, password, salt, iterations, dkLen)¶
- Parameters:
algorithm –
Algorithm
password –
PySide2.QtCore.QByteArray
salt –
PySide2.QtCore.QByteArray
iterations – int
dkLen – int
- Return type:
Returns a hash computed using the PBKDF1-algorithm as defined in RFC 8018 .
The function takes the
data
andsalt
, and then hashes it repeatedly foriterations
iterations using the specified hashalgorithm
. If the resulting hash is longer thandkLen
then it is truncated before it is returned.This function only supports SHA-1 and MD5! The max output size is 160 bits (20 bytes) when using SHA-1, or 128 bits (16 bytes) when using MD5. Specifying a value for
dkLen
which is greater than this results in a warning and an emptyQByteArray
is returned. To programmatically check this limit you can usehashLength
. Furthermore: thesalt
must always be 8 bytes long!Note
This function is provided for use with legacy applications and all new applications are recommended to use
PBKDF2
.See also
deriveKeyPbkdf2
QCryptographicHash
hashLength
- static PySide2.QtNetwork.QPasswordDigestor.deriveKeyPbkdf2(algorithm, password, salt, iterations, dkLen)¶
- Parameters:
algorithm –
Algorithm
password –
PySide2.QtCore.QByteArray
salt –
PySide2.QtCore.QByteArray
iterations – int
dkLen – int
- Return type:
Derive a key using the PBKDF2-algorithm as defined in RFC 8018 .
This function takes the
data
andsalt
, and then applies HMAC-X, where the X isalgorithm
, repeatedly. It internally concatenates intermediate results to the final output until at leastdkLen
amount of bytes have been computed and it will execute HMAC-Xiterations
times each time a concatenation is required. The total number of times it will execute HMAC-X depends oniterations
,dkLen
andalgorithm
and can be calculated asiterations * ceil(dkLen / QCryptographicHash::hashLength(algorithm))
.See also
deriveKeyPbkdf1
QMessageAuthenticationCode
QCryptographicHash
© 2022 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.