-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcrypto.h
32 lines (27 loc) · 1.01 KB
/
crypto.h
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
#ifndef CRYPTO_H
#define CRYPTO_H
#include <QByteArray>
#include <QString>
#include "tgstream.h"
struct DHKey
{
QByteArray publicKey;
QByteArray exponent;
qint64 fingerprint;
DHKey(QString publicKey, qint64 fingerprint, QString exponent = "010001");
};
qint32 randomInt(qint32 lowerThan);
QByteArray randomBytes(qint32 size);
quint64 findDivider(quint64 number);
QByteArray reverse(QByteArray array);
QByteArray xorArray(QByteArray a, QByteArray b);
QByteArray decryptAES256IGE(QByteArray data, QByteArray iv, QByteArray key);
QByteArray encryptAES256IGE(QByteArray data, QByteArray iv, QByteArray key);
QByteArray encryptRSA(QByteArray data, QByteArray key, QByteArray exp);
QByteArray hashSHA256(QByteArray dataToHash);
QByteArray hashSHA1(QByteArray dataToHash);
QByteArray calcMessageKey(QByteArray authKey, QByteArray data);
QByteArray calcEncryptionKey(QByteArray sharedKey, QByteArray msgKey, QByteArray &iv, bool client);
QByteArray rsaPad(QByteArray data, DHKey key);
qint64 randomLong();
#endif // CRYPTO_H