14 #include <QtCore/QRandomGenerator> 18 #include <QCryptographicHash> 39 static QImage *
Encrypt(QByteArray data, QImage *image,
CryptMode _mode, QString key =
"",
int _bitsUsed = 8, QString *_error =
nullptr);
49 void alertView(QString messageCode,
bool isWarning);
68 QImage *
encrypt(QByteArray data, QImage *image,
int _mode, QString key =
"",
int _bitsUsed = 8, QString *_error =
nullptr);
69 QByteArray
decrypt(QImage * image, QString key,
int _mode =
Unspecified, QString *_error =
nullptr);
70 void fail(QString message);
71 void alert(QString message,
bool isWarning =
false);
74 QByteArray
unzip(QByteArray data, QByteArray key);
94 static QImage *
Inject(QByteArray encr_data, QImage * image,
CryptMode _mode,
int _bitsUsed = 8, QString *_error =
nullptr);
96 void circuit(QImage * image, QByteArray * data,
long long int countBytes);
97 void jphs(QImage * image, QByteArray * data);
98 void processPixel(QPoint pos, QVector<QPoint> *were,
bool isEncrypt);
99 void encryptv1_4(QImage *image, QByteArray data, QString key);
100 QByteArray
decryptv1_3(QImage * image, QString key);
101 QByteArray
decryptv1_4(QImage * image, QString key);
102 void proccessPixelsv1_4(QImage *image, QByteArray* data, QByteArray key,
bool isEncrypt, QVector<QPair<QPoint, QPair<int, int> > > *were,
long long size = -1);
103 QByteArray
zip(QByteArray data, QByteArray key);
111 bool fileExists(QString path);
112 QByteArray bytes(
long long n);
113 unsigned int mod(
int input);
115 QColor RGBbytes(
long long byte);
116 QString generateVersionString(
long ver);
120 QByteArray * circuitData;
121 QImage * circuitImage;
122 long long circuitCountBytes;
124 bool mustGoOn(
bool isEncrypt);
126 QVector <bool> bitsBuffer;
127 long pop(
int bits = -1);
128 void push(
int data,
int bits = -1);
130 void setError(QString word);
131 QByteArray GetRandomBytes(
long long count = 32);
133 QImage *
inject(QByteArray encr_data, QImage * image,
int _mode,
int _bitsUsed = 8, QString *_error =
nullptr);
QByteArray decryptv1_4(QImage *image, QString key)
ModelPC::decryptv1_4 Decrypts data from image in v1.4+.
QByteArray zip(QByteArray data, QByteArray key)
ModelPC::zip Zip function, copy of EncryptDialog::zip Used for ModelPC in custom projects, other than PictureCrypt.
QString versionString
versionString Version as string
long version
version Version of the class
ModelPC()
ModelPC::ModelPC Constructor Unit tests are run here.
void alertView(QString messageCode, bool isWarning)
alertView Signal to be called to create MessageBox.
void proccessPixelsv1_4(QImage *image, QByteArray *data, QByteArray key, bool isEncrypt, QVector< QPair< QPoint, QPair< int, int > > > *were, long long size=-1)
ModelPC::proccessPixelsv1_4 Hides (or retrieves) data to/from pixels.
The ModelPC class Model Layer of the app. Main class that does the work of PictureCrypt logic Control...
QString defaultJPHSDir
defaultJPHSDir Default JPHS directory
QImage * encrypt(QByteArray data, QImage *image, int _mode, QString key="", int _bitsUsed=8, QString *_error=nullptr)
ModelPC::encrypt Slot to zip and inject data and provide it with some extra stuff After completion st...
void saveData(QByteArray data)
saveData Signal to be called to save data from ModelPC::decrypt.
QByteArray decrypt(QImage *image, QString key, int _mode=Unspecified, QString *_error=nullptr)
ModelPC::decrypt Slot to be called when decrypt mode in ViewPC is selected and started.
void jphs(QImage *image, QByteArray *data)
ModelPC::jphs JPHS function to use jphide and jpseek (currently under development) ...
void circuit(QImage *image, QByteArray *data, long long int countBytes)
ModelPC::circuit The brain of the app. Via special circuit stores data in image.
QString * error
error Current error
void encryptv1_4(QImage *image, QByteArray data, QString key)
ModelPC::encryptv1_4 Encrypts and injects data to image used in v1.4+.
QImage * inject(QByteArray encr_data, QImage *image, int _mode, int _bitsUsed=8, QString *_error=nullptr)
ModelPC::inject Slot to be called when encrypt mode in ViewPC is selected and started.
void alert(QString message, bool isWarning=false)
ModelPC::alert Function emits signal ModelPC::alertView and calls ViewPC::alert.
void setProgress(int val)
setProgress Signal to be called to set progress of ProgressDialog.
QByteArray decryptv1_3(QImage *image, QString key)
ModelPC::decryptv1_3 Decrytps data from image in v1.3.
void fail(QString message)
ModelPC::fail Slot to stop execution of cryption.
static QImage * Inject(QByteArray encr_data, QImage *image, CryptMode _mode, int _bitsUsed=8, QString *_error=nullptr)
bool success
success Flag that true by default, but in case of error or cancelling of ProgressDialog it turns to f...
QByteArray unzip(QByteArray data, QByteArray key)
ModelPC::unzip Unzip data from ModelPC::decrypt. Just mirrored EncryptDialog::zip.
void saveImage(QImage *image)
saveImage Signal to be called to save image from ModelPC::encrypt.
static QByteArray Decrypt(QImage *image, QString key, CryptMode _mode=Unspecified, QString *_error=nullptr)
static QImage * Encrypt(QByteArray data, QImage *image, CryptMode _mode, QString key="", int _bitsUsed=8, QString *_error=nullptr)
void processPixel(QPoint pos, QVector< QPoint > *were, bool isEncrypt)
ModelPC::processPixel Processes every pixel. Reads its contains or writes data.