QPasswordDigestor Namespace
QPasswordDigestor 네임스페이스에는 해시 또는 키를 생성하는 데 사용할 수 있는 함수가 포함되어 있습니다. 더 보기...
헤더: | #include <QPasswordDigestor> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Network) target_link_libraries(mytarget PRIVATE Qt6::Network) |
qmake: | QT += network |
함수
QByteArray | deriveKeyPbkdf1(QCryptographicHash::Algorithm algorithm, const QByteArray &data, const QByteArray &salt, int iterations, quint64 dkLen) |
QByteArray | deriveKeyPbkdf2(QCryptographicHash::Algorithm algorithm, const QByteArray &data, const QByteArray &salt, int iterations, quint64 dkLen) |
함수 문서
QByteArray QPasswordDigestor::deriveKeyPbkdf1(QCryptographicHash::Algorithm algorithm, const QByteArray &data, const QByteArray &salt, int iterations, quint64 dkLen)
RFC 8018, 섹션 5.1에 정의된 대로 PBKDF1 알고리즘을 사용하여 계산된 해시를 반환합니다.
이 함수는 data 및 salt 을 받은 다음 지정된 해시 algorithm 를 사용하여 iterations 반복에 대해 반복적으로 해시합니다. 결과 해시가 dkLen 보다 길면 반환되기 전에 잘립니다.
이 함수는 SHA-1과 MD5만 지원합니다! 최대 출력 크기는 SHA-1을 사용하는 경우 160비트(20바이트), MD5를 사용하는 경우 128비트(16바이트)입니다. 이보다 큰 값을 dkLen 에 지정하면 경고가 표시되고 빈 QByteArray 이 반환됩니다. 프로그래밍 방식으로 이 제한을 확인하려면 QCryptographicHash::hashLength 을 사용할 수 있습니다. 또한 salt 은 항상 8바이트 길이여야 합니다!
참고: 이 함수는 레거시 애플리케이션과 함께 사용하기 위해 제공되며 모든 새 애플리케이션은 PBKDF2 을 사용하는 것이 좋습니다.
deriveKeyPbkdf2, QCryptographicHash, QCryptographicHash::hashLength 를참조하세요 .
QByteArray QPasswordDigestor::deriveKeyPbkdf2(QCryptographicHash::Algorithm algorithm, const QByteArray &data, const QByteArray &salt, int iterations, quint64 dkLen)
RFC 8018, 섹션 5.2에 정의된 대로 PBKDF2 알고리즘을 사용하여 키를 도출합니다.
이 함수는 data 와 salt 를 가져온 다음 HMAC-X(여기서 X는 algorithm)를 반복적으로 적용합니다. 최소 dkLen 바이트가 계산될 때까지 내부적으로 중간 결과를 최종 출력에 연결하며, 연결이 필요할 때마다 HMAC-X iterations 를 매번 실행합니다. HMAC-X를 실행하는 총 횟수는 iterations, dkLen 및 algorithm 에 따라 달라지며 iterations * ceil(dkLen / QCryptographicHash::hashLength(algorithm))
로 계산할 수 있습니다.
deriveKeyPbkdf1, QMessageAuthenticationCode, QCryptographicHash 를참조하세요 .
© 2025 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.