diff --git a/src/controller.cpp b/src/controller.cpp index 5e9f9c3..9500e81 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -108,22 +108,6 @@ void Controller::setConnection(Connection* c) ui->listChat->verticalScrollBar()->maximum()); } -std::string Controller::encryptDecrypt(std::string toEncrypt) -{ - - int radomInteger = rand() % 1000000000 +100000; - - - char key = radomInteger; - std::string output = toEncrypt; - - for (int i = 0; i < toEncrypt.size(); i++) - output[i] = toEncrypt[i] ^ key; - - return output; - -} - // Build the RPC JSON Parameters for this tx void Controller::fillTxJsonParams(json& allRecepients, Tx tx) { @@ -153,43 +137,28 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx) } DataStore::getSietchDataStore()->clear(); // clears the datastore + + const QString possibleCharacters("0123456789abcdef"); + int sizerandomString = 512; + const int randomStringLength = sizerandomString; + + for(uint8_t i = 0; i < 8; i++) + { - const QString possibleCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); + QString randomString; - int sizerandomString = rand() % 120 +10; - const int randomStringLength = sizerandomString; + QRandomGenerator *gen = QRandomGenerator::system(); - QString randomString; - QRandomGenerator *gen = QRandomGenerator::system(); for(int i=0; ibounded(0, possibleCharacters.length() - 1); QChar nextChar = possibleCharacters.at(index); randomString.append(nextChar); } - - for(uint8_t i = 0; i < 8; i++) - { - int length = randomString.length(); - int randomSize = rand() % 120 +10; - char *randomHash = NULL; - randomHash = new char[length+1]; - strncpy(randomHash, randomString.toLocal8Bit(), length +1); - #define MESSAGE ((const unsigned char *) randomHash) - #define MESSAGE_LEN length - #define MESSAGE_LEN1 length + randomSize - - unsigned char hash[crypto_secretstream_xchacha20poly1305_ABYTES]; - crypto_generichash(hash, sizeof hash, - MESSAGE, MESSAGE_LEN1, - NULL, 0); + dust.at(i)["memo"] = randomString.toStdString(); - std::string decryptedMemo(reinterpret_cast(hash),MESSAGE_LEN1); - std::string encrypt = this->encryptDecrypt(decryptedMemo); - QString randomHashafter1 = QByteArray(reinterpret_cast(encrypt.c_str()),encrypt.size()).toHex(); - dust.at(i)["memo"] = randomHashafter1.toStdString(); } for(auto &it: dust) diff --git a/src/controller.h b/src/controller.h index bbf3cc7..a3333c2 100644 --- a/src/controller.h +++ b/src/controller.h @@ -45,8 +45,7 @@ public: int getLag(); void setLag(int lag); int _lag; - std::string encryptDecrypt(std::string); - + void checkForUpdate(bool silent = true); void refreshZECPrice(); void refreshEURPrice();