File indexing completed on 2024-05-12 15:59:54
0001 #/* 0002 * SPDX-FileCopyrightText: 2015 Stefano Bonicatti <smjert@gmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 #ifndef KOMD5GENERATOR_H 0007 #define KOMD5GENERATOR_H 0008 0009 #include <QByteArray> 0010 #include <QString> 0011 0012 #include <kritaresources_export.h> 0013 0014 class QIODevice; 0015 0016 class KRITARESOURCES_EXPORT KoMD5Generator 0017 { 0018 public: 0019 /** 0020 * @brief generateHash reads the given file and generates 0021 * a hex-encoded md5sum for the file. 0022 * @param filename the file to open 0023 * @return a hex-encoded string representation of the md5sum 0024 */ 0025 static QString generateHash(const QString &filename); 0026 0027 /** 0028 * @brief generateHash calculates the md5sum of the given bytes 0029 * @param QByteArray the contents to be calculated 0030 * @return a hex-encoded string representation of the md5sum 0031 */ 0032 static QString generateHash(const QByteArray &array); 0033 0034 /** 0035 * @brief generateHash calculates the md5sum of the given device 0036 * @param QIODevice 0037 * @return a hex-encoded string representation of the md5sum 0038 */ 0039 static QString generateHash(QIODevice *device); 0040 }; 0041 0042 #endif