[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [messagelib] webengineviewer/src/checkphishingurl: Try to compare ssh256
From:       Montel Laurent <montel () kde ! org>
Date:       2016-11-24 6:06:31
Message-ID: E1c9nB1-00012j-ST () code ! kde ! org
[Download RAW message or body]

Git commit 376172ecac1633d5978b986e5bb47f56bf9d3e22 by Montel Laurent.
Committed on 24/11/2016 at 06:06.
Pushed by mlaurent into branch 'master'.

Try to compare ssh256

M  +9    -2    webengineviewer/src/checkphishingurl/createdatabasefilejob.cpp

https://commits.kde.org/messagelib/376172ecac1633d5978b986e5bb47f56bf9d3e22

diff --git a/webengineviewer/src/checkphishingurl/createdatabasefilejob.cpp \
b/webengineviewer/src/checkphishingurl/createdatabasefilejob.cpp index \
                029d675..95f055d 100644
--- a/webengineviewer/src/checkphishingurl/createdatabasefilejob.cpp
+++ b/webengineviewer/src/checkphishingurl/createdatabasefilejob.cpp
@@ -134,21 +134,28 @@ void CreateDatabaseFileJob::createFileFromFullUpdate(const \
QVector<Addition> &ad  }
     }
     const qint64 numberOfElement = itemToStore.count();
-    hashStartPosition += mFile.write(reinterpret_cast<const char \
*>(&numberOfElement), sizeof(qint64)); +    hashStartPosition += \
mFile.write(reinterpret_cast<const char *>(&numberOfElement), \
sizeof(numberOfElement));  
     //3 add index of items
     qint64 tmpPos = hashStartPosition;
     Q_FOREACH (const Addition &add, itemToStore) {
-        mFile.write(reinterpret_cast<const char *>(&tmpPos), sizeof(qint64));
+        mFile.write(reinterpret_cast<const char *>(&tmpPos), sizeof(tmpPos));
         tmpPos += add.prefixSize;
     }
     //TODO verify position.
 
     //4 add items
+    QByteArray newSsha256;
     Q_FOREACH (const Addition &add, itemToStore) {
         QByteArray ba = add.hashString;
         mFile.write(reinterpret_cast<const char *>(ba.constData()), \
add.hashString.size()); +        newSsha256 += ba;
     }
     mFile.close();
     //Verify hash with sha256
+    const QByteArray newSsha256Value = QCryptographicHash::hash(newSsha256, \
QCryptographicHash::Sha256); +    if (newSsha256Value != sha256.toLatin1()) {
+        qCWarning(WEBENGINEVIEWER_LOG) << " newSsha256Value different from sha256 : \
" << newSsha256Value << " from server " << sha256; +        \
qCWarning(WEBENGINEVIEWER_LOG) << " newSsha256 : " << newSsha256; +    }
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic