Commit afdf8f26 authored by Natsumi Higa's avatar Natsumi Higa Committed by Elvis Angelaccio
Browse files

Display BLAKE2 file checksums for RAR files

Summary: When creating a RAR 5.0 archive, BLAKE2sp can be used instead of CRC32 for file checksums. This diff adds an entry for BLAKE2 file checksum.

Test Plan:
Attached is a RAR 5.0 archive using BLAKE2sp file checksums.

{F6875541}

Reviewers: #ark, elvisangelaccio

Subscribers: #ark, kde-utils-devel

Tags: #ark

Differential Revision: https://phabricator.kde.org/D21637
parent 5bc23e40
......@@ -55,6 +55,7 @@ void Archive::Entry::copyMetaData(const Archive::Entry *sourceEntry)
setProperty("link", sourceEntry->property("link"));
setProperty("ratio", sourceEntry->property("ratio"));
setProperty("CRC", sourceEntry->property("CRC"));
setProperty("BLAKE2", sourceEntry->property("BLAKE2"));
setProperty("method", sourceEntry->property("method"));
setProperty("version", sourceEntry->property("version"));
setProperty("timestamp", sourceEntry->property("timestamp").toDateTime());
......
......@@ -62,6 +62,7 @@ class Archive::Entry : public QObject
Q_PROPERTY(QString link MEMBER m_link)
Q_PROPERTY(QString ratio MEMBER m_ratio)
Q_PROPERTY(QString CRC MEMBER m_CRC)
Q_PROPERTY(QString BLAKE2 MEMBER m_BLAKE2)
Q_PROPERTY(QString method MEMBER m_method)
Q_PROPERTY(QString version MEMBER m_version)
Q_PROPERTY(QDateTime timestamp MEMBER m_timestamp)
......@@ -117,6 +118,7 @@ private:
QString m_link;
QString m_ratio;
QString m_CRC;
QString m_BLAKE2;
QString m_method;
QString m_version;
QDateTime m_timestamp;
......
......@@ -61,6 +61,7 @@ ArchiveModel::ArchiveModel(const QString &dbusPathName, QObject *parent)
{ Group, "group" },
{ Ratio, "ratio" },
{ CRC, "CRC" },
{ BLAKE2, "BLAKE2" },
{ Method, "method" },
{ Version, "version" },
{ Timestamp, "timestamp" },
......@@ -184,7 +185,9 @@ QVariant ArchiveModel::headerData(int section, Qt::Orientation, int role) const
case Permissions:
return i18nc("File permissions", "Mode");
case CRC:
return i18nc("CRC hash code", "CRC");
return i18nc("CRC hash code", "CRC checksum");
case BLAKE2:
return i18nc("BLAKE2 hash code", "BLAKE2 checksum");
case Method:
return i18nc("Compression method", "Method");
case Version:
......
......@@ -52,6 +52,7 @@ enum EntryMetaDataType {
Group, /**< The user group the entry belongs to */
Ratio, /**< The compression ratio for the entry */
CRC, /**< The entry's CRC */
BLAKE2, /**< The entry's BLAKE2 */
Method, /**< The compression method used on the entry */
Version, /**< The archiver version needed to extract the entry */
Timestamp /**< The timestamp for the current entry */
......
......@@ -298,6 +298,7 @@ void CliPlugin::handleUnrar5Entry()
e->setProperty("compressedSize", m_unrar5Details.value(QStringLiteral("packed size")));
e->setProperty("permissions", m_unrar5Details.value(QStringLiteral("attributes")));
e->setProperty("CRC", m_unrar5Details.value(QStringLiteral("crc32")));
e->setProperty("BLAKE2", m_unrar5Details.value(QStringLiteral("blake2")));
if (e->property("permissions").toString().startsWith(QLatin1Char('l'))) {
e->setProperty("link", m_unrar5Details.value(QStringLiteral("target")));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment