File indexing completed on 2024-06-16 05:24:52

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2009, 2011, 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 #include "bytearraychecksumalgorithmfactory.hpp"
0010 
0011 // lib
0012 #include "algorithm/adler32bytearraychecksumalgorithm.hpp"
0013 #include "algorithm/crc32bytearraychecksumalgorithm.hpp"
0014 #include "algorithm/crc64bytearraychecksumalgorithm.hpp"
0015 #include "algorithm/modsum8bytearraychecksumalgorithm.hpp"
0016 #include "algorithm/modsum16bytearraychecksumalgorithm.hpp"
0017 #include "algorithm/modsum32bytearraychecksumalgorithm.hpp"
0018 #include "algorithm/modsum64bytearraychecksumalgorithm.hpp"
0019 #include "algorithm/qcryptographicbytearraychecksumalgorithm.hpp"
0020 // NEWCHECKSUM(start)
0021 // Here add the name of your header file of your checksum algorithm,
0022 // e.g.
0023 // #include "algorithm/mybytearraychecksumalgorithm.hpp"
0024 // NEWCHECKSUM(end)
0025 // KF
0026 #include <KLocalizedString>
0027 // Qt
0028 #include <QVector>
0029 
0030 QVector<AbstractByteArrayChecksumAlgorithm*> ByteArrayChecksumAlgorithmFactory::createAlgorithms()
0031 {
0032     QVector<AbstractByteArrayChecksumAlgorithm*> result {
0033         new ModSum8ByteArrayChecksumAlgorithm(),
0034         new ModSum16ByteArrayChecksumAlgorithm(),
0035         new ModSum32ByteArrayChecksumAlgorithm(),
0036         new ModSum64ByteArrayChecksumAlgorithm(),
0037         new Adler32ByteArrayChecksumAlgorithm(),
0038         new Crc32ByteArrayChecksumAlgorithm(),
0039         new Crc64ByteArrayChecksumAlgorithm(),
0040         // TODO: MD2? was provided by QCA
0041         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "MD4"),
0042                      QStringLiteral("MD4"),  QCryptographicHash::Md4),
0043         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "MD5"),
0044                      QStringLiteral("MD5"),  QCryptographicHash::Md5),
0045         // TODO: SHA0? was provided by QCA
0046         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "SHA-1"),
0047                      QStringLiteral("SHA-1"), QCryptographicHash::Sha1),
0048         // TODO: RIPEMD160? was provided by QCA
0049         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "SHA-224"),
0050                      QStringLiteral("SHA-224"),  QCryptographicHash::Sha224),
0051         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "SHA-256"),
0052                      QStringLiteral("SHA-256"),  QCryptographicHash::Sha256),
0053         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "SHA-384"),
0054                      QStringLiteral("SHA-384"),  QCryptographicHash::Sha384),
0055         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "SHA-512"),
0056                      QStringLiteral("SHA-512"),  QCryptographicHash::Sha512),
0057         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "SHA3-224"),
0058                      QStringLiteral("SHA3-224"),  QCryptographicHash::Sha3_224),
0059         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "SHA3-256"),
0060                      QStringLiteral("SHA3-256"),  QCryptographicHash::Sha3_256),
0061         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "SHA3-384"),
0062                      QStringLiteral("SHA3-384"),  QCryptographicHash::Sha3_384),
0063         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "SHA3-512"),
0064                      QStringLiteral("SHA3-512"),  QCryptographicHash::Sha3_512),
0065         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "Keccak-224"),
0066                      QStringLiteral("Keccak-224"),  QCryptographicHash::Keccak_224),
0067         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "Keccak-256"),
0068                      QStringLiteral("Keccak-256"),  QCryptographicHash::Keccak_256),
0069         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "Keccak-384"),
0070                      QStringLiteral("Keccak-384"),  QCryptographicHash::Keccak_384),
0071         new QCryptographicByteArrayChecksumAlgorithm(i18nc("name of the hash algorithm", "Keccak-512"),
0072                      QStringLiteral("Keccak-512"),  QCryptographicHash::Keccak_512),
0073         // TODO: Whirlpool? was provided by QCA
0074 // NEWCHECKSUM(start)
0075 // Here add the creation of an object of your checksum algorithm class and add it to the list,
0076 // e.g.
0077 //         new MyByteArrayChecksumAlgorithm(),
0078 // NEWCHECKSUM(end)
0079     };
0080 
0081     return result;
0082 }