From 9f109e8c427f9855d7ac18aed384af42e0d45cf7 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 12 Dec 2023 00:12:27 +0100 Subject: [PATCH] dice: domain separate by number of sides --- src/dialog/SeedDiceDialog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dialog/SeedDiceDialog.cpp b/src/dialog/SeedDiceDialog.cpp index 9877c96..efe0203 100644 --- a/src/dialog/SeedDiceDialog.cpp +++ b/src/dialog/SeedDiceDialog.cpp @@ -100,8 +100,10 @@ SeedDiceDialog::SeedDiceDialog(QWidget *parent) data.append(random, POLYSEED_RANDBYTES); + int sides = ui->radio_coinflip->isChecked() ? 2 : ui->spin_sides->value(); + QByteArray salt = "POLYSEED-" + QString::number(sides).toUtf8(); // domain separate by number of sides + // Polyseed requests 19 bytes of random data and discards two bits (for a total of 150 bits) - QByteArray salt = "POLYSEED"; m_key = QPasswordDigestor::deriveKeyPbkdf2(QCryptographicHash::Sha256, data, salt, 2048, 19); sodium_memzero(data.data(), data.size());