dice: domain separate by number of sides

This commit is contained in:
tobtoht 2023-12-12 00:12:27 +01:00
parent a131bbc165
commit 9f109e8c42
No known key found for this signature in database
GPG key ID: E45B10DD027D2472

View file

@ -100,8 +100,10 @@ SeedDiceDialog::SeedDiceDialog(QWidget *parent)
data.append(random, POLYSEED_RANDBYTES); 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) // 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); m_key = QPasswordDigestor::deriveKeyPbkdf2(QCryptographicHash::Sha256, data, salt, 2048, 19);
sodium_memzero(data.data(), data.size()); sodium_memzero(data.data(), data.size());