openPilotLog
md5sum.h
1 /*
2  *openPilotLog - A FOSS Pilot Logbook Application
3  *Copyright (C) 2020-2022 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 MD5SUM_H
19 #define MD5SUM_H
20 #include <QtCore>
21 #include <QByteArray>
22 #include <QCryptographicHash>
23 
27 class Md5Sum
28 {
29 public:
34  Md5Sum(QFileInfo &file_info);
35  Md5Sum() = delete;
36 
37  QByteArray checksum;
38 
42  inline const QString hashToHex() const
43  {
44  return QString(checksum.toHex());
45  };
46 
52  bool compare(QFileInfo &md5_file) const;
53 };
54 
55 #endif // MD5SUM_H
The Md5Sum class is responsible for calculating cryptographic hashes of files (used to verify downloa...
Definition: md5sum.h:28
bool compare(QFileInfo &md5_file) const
compare reads the pre-calculated md5-sum from a checkfile and compares the hashes.
Definition: md5sum.cpp:39
const QString hashToHex() const
hashString returns a hex representation of the hash
Definition: md5sum.h:42