XX CMake Package
Loading...
Searching...
No Matches
XXShallowCrypt.h
Go to the documentation of this file.
1#ifndef XXShallowCryptH
2#define XXShallowCryptH
3
4#include "XXCoreExportDef.h"
5
6#include <QCryptographicHash>
7#include <QString>
8#include <QSysInfo>
9
10namespace XX
11{
13
19
21 {
22 public:
24 ShallowCrypt(QByteArray key = QSysInfo::machineUniqueId(), QCryptographicHash::Algorithm algorithm = QCryptographicHash::Sha1);
25
26 public:
27 QByteArray bury(const QString& plainText) const;
28 QString revive(const QByteArray encryptedText) const;
29
30 private:
31 void encrypt(QByteArray& data) const;
32 void decrypt(QByteArray& data) const;
33 QByteArray randomByte() const;
34 QByteArray addCheckAndScramble(const QByteArray& payload) const;
35 QByteArray unscrambleAndVerify(const QByteArray& data) const;
36 QByteArray rotateUnevenBytes(const QByteArray& data) const;
37
38 private:
39 QByteArray key;
40 QCryptographicHash::Algorithm algorithm;
41 int checkLength;
42 };
43} // namespace XX
44
45#endif // NOT XXShallowCryptH
#define XXCORE_DECLSPEC
Definition XXCoreExportDef.h:11
ShallowCrypt(QByteArray key=QSysInfo::machineUniqueId(), QCryptographicHash::Algorithm algorithm=QCryptographicHash::Sha1)
no key => no encryption!
QByteArray bury(const QString &plainText) const
QString revive(const QByteArray encryptedText) const
Definition XXPopulatedAbstract.h:11