| openPilotLog

ahash.h
1 /*
2 *openPilotLog - A FOSS Pilot Logbook Application
3 *Copyright (C) 2020-2021 Felix Turowsky
4 *
5 *This program is free software: you can redistribute it and/or modify
6 *it under the terms of the GNU General Public License as published by
7 *the Free Software Foundation, either version 3 of the License, or
8 *(at your option) any later version.
9 *
10 *This program is distributed in the hope that it will be useful,
11 *but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *GNU General Public License for more details.
14 *
15 *You should have received a copy of the GNU General Public License
16 *along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18 #ifndef AHASH_H
19 #define AHASH_H
20 #include <QtCore>
21 #include <QByteArray>
22 #include <QCryptographicHash>
23
27 class AHash
28 {
29 public:
34 AHash(QFileInfo &file_info);
35
36 QByteArray checksum;
37
41 inline const QString hashToHex()
42 {
43 return QString(checksum.toHex());
44 };
45
51 bool compare(QFileInfo &md5_file);
52 };
53
54 #endif // AHASH_H
AHash
The AHash class is responsible for calculating cryptographic hashes of files (used to verify download...
Definition: ahash.h:28
AHash::hashToHex
const QString hashToHex()
hashString returns a hex representation of the hash
Definition: ahash.h:41
AHash::AHash
AHash(QFileInfo &file_info)
AHash - calculates the MD5-checksum for the parameter given in the constructor and saves the result i...
Definition: ahash.cpp:21
AHash::compare
bool compare(QFileInfo &md5_file)
compare reads the pre-calculated md5-sum from a checkfile and compares the hashes.
Definition: ahash.cpp:39