File indexing completed on 2024-06-23 05:48:48

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2009, 2023 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_QCRYPTOGRAPHICBYTEARRAYCHECKSUMALGORITHM_HPP
0010 #define KASTEN_QCRYPTOGRAPHICBYTEARRAYCHECKSUMALGORITHM_HPP
0011 
0012 //
0013 #include "nobytearraychecksumparameterset.hpp"
0014 //
0015 #include <abstractbytearraychecksumalgorithm.hpp>
0016 // Qt
0017 #include <QCryptographicHash>
0018 
0019 class QCryptographicByteArrayChecksumAlgorithm : public AbstractByteArrayChecksumAlgorithm
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     QCryptographicByteArrayChecksumAlgorithm(const QString& name, const QString& id,
0025                                              QCryptographicHash::Algorithm algorithm);
0026     ~QCryptographicByteArrayChecksumAlgorithm() override;
0027 
0028 public: // AbstractByteArrayChecksumAlgorithm API
0029     bool calculateChecksum(QString* result, const Okteta::AbstractByteArrayModel* model, const Okteta::AddressRange& range) const override;
0030     AbstractByteArrayChecksumParameterSet* parameterSet() override;
0031 
0032 private:
0033     NoByteArrayChecksumParameterSet mParameterSet;
0034     const QCryptographicHash::Algorithm m_algorithm;
0035 };
0036 
0037 #endif