[KPhotoAlbum] Breaking changes in file layout

Tobias Leupold tobias.leupold at gmx.de
Mon Apr 6 14:51:51 BST 2020


> Yeah, of course it's no problem to calculate an MD5 or SHA-1 hash from a
> path. I only thought this would give us a long hash, and the checksum used
> here is quite short. Well, of, course, the 8 or whatever leftmost chars of
> the hex representation of a MD5 hash should be do the job as well and would
> also be short.

That would then be something like this (I didn't try the below code):

    QString Whatever::dbIdentifier(const QString &indexXml) const
    {
        const QFileInfo fileInfo(indexXml);
        return QStringLiteral("%1-%2").arg(
            QString::fromUtf8(QCryptographicHash::hash(
                indexXml.toUtf8(),
                QCryptographicHash::Md5).toHex()).left(8),
            fileInfo.dir().dirName());
    }





More information about the Kphotoalbum mailing list