account refactoring

This commit is contained in:
Blue 2020-06-15 00:23:43 +03:00
parent 20bcae5ab2
commit 87426ee20f
9 changed files with 797 additions and 702 deletions

View file

@ -36,10 +36,7 @@ SimpleCrypt::SimpleCrypt():
m_key(0),
m_compressionMode(CompressionAuto),
m_protectionMode(ProtectionChecksum),
m_lastError(ErrorNoError)
{
qsrand(uint(QDateTime::currentMSecsSinceEpoch() & 0xFFFF));
}
m_lastError(ErrorNoError) {}
SimpleCrypt::SimpleCrypt(quint64 key):
m_key(key),
@ -47,7 +44,6 @@ m_compressionMode(CompressionAuto),
m_protectionMode(ProtectionChecksum),
m_lastError(ErrorNoError)
{
qsrand(uint(QDateTime::currentMSecsSinceEpoch() & 0xFFFF));
splitKey();
}
@ -113,7 +109,7 @@ QByteArray SimpleCrypt::encryptToByteArray(QByteArray plaintext)
}
//prepend a random char to the string
char randomChar = char(qrand() & 0xFF);
char randomChar = char(QRandomGenerator::global()->generate() & 0xFF);
ba = randomChar + integrityProtection + ba;
int pos(0);

View file

@ -30,6 +30,7 @@
#include <QString>
#include <QVector>
#include <QFlags>
#include <QRandomGenerator>
/**
@ short Simple encrypt*ion and decryption of strings and byte arrays