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 를 입력으로 받아, X가 algorithm 인 HMAC-X를 반복적으로 적용합니다. 내부적으로 중간 결과를 최종 출력에 연결하여 최소 dkLen 바이트가 계산될 때까지 처리하며, 연결이 필요할 때마다 HMAC-X를 iterations 회 실행합니다. HMAC-X가 실행되는 총 횟수는 iterations, dkLen 및 algorithm 에 따라 달라지며, iterations * ceil(dkLen / QCryptographicHash::hashLength(algorithm)) 로 계산할 수 있습니다.
deriveKeyPbkdf1, QMessageAuthenticationCode 및 QCryptographicHash도 참조하십시오 .
© 2026 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.