]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
dice: domain separate by number of sides
authortobtoht <tob@featherwallet.org>
Mon, 11 Dec 2023 23:12:27 +0000 (00:12 +0100)
committertobtoht <tob@featherwallet.org>
Mon, 11 Dec 2023 23:12:27 +0000 (00:12 +0100)
src/dialog/SeedDiceDialog.cpp

index 9877c966984897b81f206e084a90c240d71a109f..efe0203fb907f773dbeee0585c1926d14a38685a 100644 (file)
@@ -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());