1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// SPDX-FileCopyrightText: 2022 Linus Jahn <lnj@kaidan.im>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef QXMPPHASH_H
#define QXMPPHASH_H
#include "QXmppGlobal.h"
#include <QByteArray>
class QDomElement;
class QXmlStreamWriter;
namespace QXmpp {
enum class HashAlgorithm : uint32_t {
Unknown,
Md2,
Md5,
Shake128,
Shake256,
Sha1,
Sha224,
Sha256,
Sha384,
Sha512,
Sha3_256,
Sha3_512,
Blake2b_256,
Blake2b_512,
};
}
class QXMPP_EXPORT QXmppHash
{
public:
QXmppHash();
/// \cond
bool parse(const QDomElement &el);
void toXml(QXmlStreamWriter *writer) const;
/// \endcond
QXmpp::HashAlgorithm algorithm() const;
void setAlgorithm(QXmpp::HashAlgorithm algorithm);
QByteArray hash() const;
void setHash(const QByteArray &data);
private:
QXmpp::HashAlgorithm m_algorithm = QXmpp::HashAlgorithm::Unknown;
QByteArray m_hash;
};
class QXMPP_EXPORT QXmppHashUsed
{
public:
QXmppHashUsed();
QXmppHashUsed(QXmpp::HashAlgorithm algorithm);
/// \cond
bool parse(const QDomElement &el);
void toXml(QXmlStreamWriter *writer) const;
/// \endcond
QXmpp::HashAlgorithm algorithm() const;
void setAlgorithm(QXmpp::HashAlgorithm algorithm);
private:
QXmpp::HashAlgorithm m_algorithm = QXmpp::HashAlgorithm::Unknown;
};
#endif // QXMPPHASH_H
|