QString fiatAmount = (usd_price > 0) ? QString::number(fiat_price, 'f', 2) : "?";
QString line = QString(R"(%1,%2,"%3",%4,"%5",%6,%7,%8,"%9","%10","%11","%12","%13")")
- .arg(QString::number(tx.blockHeight),
- QString::number(tx.timestamp.toSecsSinceEpoch()),
- date,
- QString::number(tx.subaddrAccount),
- direction,
- balanceDelta,
- tx.displayAmount(),
- tx.displayFee(),
- tx.hash,
- tx.description,
- paymentId,
- fiatAmount,
- "USD");
+ .arg(QString::number(tx.blockHeight)) // %1
+ .arg(QString::number(tx.timestamp.toSecsSinceEpoch()))
+ .arg(date)
+ .arg(QString::number(tx.subaddrAccount))
+ .arg(direction) // %5
+ .arg(balanceDelta)
+ .arg(tx.displayAmount())
+ .arg(tx.displayFee())
+ .arg(tx.hash)
+ .arg(tx.description) // %10
+ .arg(paymentId)
+ .arg(fiatAmount)
+ .arg("USD");
csvData.append({tx.blockHeight, line});
}
ui->progressBar->setMaximum(39024);
ui->progressBar->setValue(0);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList words = ui->seed->toPlainText().replace("\n", " ").replace("\r", "").trimmed().split(" ", Qt::SkipEmptyParts);
+#else
+ QStringList words = ui->seed->toPlainText().replace("\n", " ").replace("\r", "").trimmed().split(" ", QString::SkipEmptyParts);
+#endif
+
if (words.length() < 24) {
Utils::showError(this, "Invalid seed", "Less than 24 words were entered", {"Remember to use a single space between each word."});
return;
for (int i = 0; i < 24; i++) {
QStringList seed = words;
- seed.swapItemsAt(i, i+1);
+ std::swap(seed[i], seed[i+1]);
QString m = seed.join(" ");
bool done = this->testSeed(m, spkey);
}
// Swap back
- seed.swapItemsAt(i, i+1);
+ std::swap(seed[i], seed[i+1]);
}
if (m_cancelled) {
#include <sodium/randombytes.h>
#include "polyseed/polyseed.h"
+#include <QtGlobal>
+
+// Use QPasswordDigestor only on newer Qt versions (5.15+)
+// Fallback to OpenSSL for Ubuntu 20.04 (Qt 5.12)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
#include <QPasswordDigestor>
+#else
+#include <openssl/evp.h> // TODO: add tests for this block
+#endif
#include "utils/Seed.h"
int sides = ui->radio_coinflip->isChecked() ? 2 : ui->spin_sides->value();
QByteArray salt = "POLYSEED-" + QString::number(sides).toUtf8(); // domain separate by number of sides
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+ // Modern Qt (Ubuntu 22.04+)
// Polyseed requests 19 bytes of random data and discards two bits (for a total of 150 bits)
m_key = QPasswordDigestor::deriveKeyPbkdf2(QCryptographicHash::Sha256, data, salt, 2048, 19);
+#else
+ // Legacy Qt 5.12 (Ubuntu 20.04) - Fallback to OpenSSL
+ m_key.resize(19);
+ PKCS5_PBKDF2_HMAC(data.data(), data.length(),
+ reinterpret_cast<const unsigned char*>(salt.data()), salt.length(),
+ 2048, // Iterations
+ EVP_sha256(), // Match QCryptographicHash::Sha256
+ 19, // Output Key Size
+ reinterpret_cast<unsigned char*>(m_key.data()));
+#endif
sodium_memzero(data.data(), data.size());
sodium_memzero(&random, POLYSEED_RANDBYTES);
QDate start = m_fromDateEdit->date();
QDate end = m_toDateEdit->date();
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+ // Modern Qt (Ubuntu 22.04+)
uint64_t startHeight = lookup->dateToHeight(start.startOfDay().toSecsSinceEpoch());
uint64_t endHeight = lookup->dateToHeight(end.endOfDay().toSecsSinceEpoch());
+#else
+ // Legacy Qt 5.12 (Ubuntu 20.04)
+ // Manually construct the DateTime for 00:00:00 and 23:59:59
+ uint64_t startHeight = lookup->dateToHeight(QDateTime(start, QTime(0, 0, 0)).toSecsSinceEpoch());
+ uint64_t endHeight = lookup->dateToHeight(QDateTime(end, QTime(23, 59, 59)).toSecsSinceEpoch());
+#endif
if (endHeight < startHeight) endHeight = startHeight;
m_estimatedBlocks = endHeight - startHeight;