Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

Talk:New Features in Qt 5.9

From Qt Wiki
Jump to navigation Jump to search

Highlight QCryptographicHash::Sha3_* changes

Consider highlighting the fact that the QCryptographicHash::Sha3_* algorithms were broken in Qt 5.8 and now fixed in Qt 5.9. I had password hashes that were generated with Qt 5.8 and no longer worker after upgrading to Qt 5.9.

#include <QByteArray>
#include <QCryptographicHash>
#include <QDebug>
#include <QList>

int main(int , char *[])
{
    QByteArray plaintext("1234");
    QList<QCryptographicHash::Algorithm> hashAlgorithms;
    hashAlgorithms << QCryptographicHash::Md4
                   << QCryptographicHash::Md5
                   << QCryptographicHash::Sha1
                   << QCryptographicHash::Sha224
                   << QCryptographicHash::Sha256
                   << QCryptographicHash::Sha384
                   << QCryptographicHash::Sha512
                   << QCryptographicHash::Sha3_224
                   << QCryptographicHash::Sha3_256
                   << QCryptographicHash::Sha3_384
                   << QCryptographicHash::Sha3_512;

    qDebug() << "Qt version: " << qVersion();
    for (auto algo : hashAlgorithms) {
        qDebug() << algo << ":" << QCryptographicHash::hash(plaintext, algo).toBase64();
    }

    return 0;
}