From c840e2b664dc03e4f06e401082891807a8fed4b3 Mon Sep 17 00:00:00 2001 From: stoffu Date: Fri, 6 Jul 2018 18:39:58 +0900 Subject: Allow adjusting number of rounds for the key derivation function --- wizard/WizardCreateWallet.qml | 3 ++- wizard/WizardOptions.qml | 31 +++++++++++++++++++++++++++++++ wizard/WizardRecoveryWallet.qml | 5 +++-- 3 files changed, 36 insertions(+), 3 deletions(-) (limited to 'wizard') diff --git a/wizard/WizardCreateWallet.qml b/wizard/WizardCreateWallet.qml index f25d2047..8ab4d143 100644 --- a/wizard/WizardCreateWallet.qml +++ b/wizard/WizardCreateWallet.qml @@ -86,8 +86,9 @@ ColumnLayout { var tmp_wallet_filename = oshelper.temporaryFilename(); console.log("Creating temporary wallet", tmp_wallet_filename) var nettype = appWindow.persistentSettings.nettype; + var kdfRounds = appWindow.persistentSettings.kdfRounds; var wallet = walletManager.createWallet(tmp_wallet_filename, "", settingsObject.wallet_language, - nettype) + nettype, kdfRounds) uiItem.wordsTextItem.memoText = wallet.seed // saving wallet in "global" settings object // TODO: wallet should have a property pointing to the file where it stored or loaded from diff --git a/wizard/WizardOptions.qml b/wizard/WizardOptions.qml index 3406c036..c4366307 100644 --- a/wizard/WizardOptions.qml +++ b/wizard/WizardOptions.qml @@ -28,6 +28,7 @@ import QtQuick 2.2 import QtQml 2.2 +import QtQuick.Controls 2.0 import QtQuick.Layouts 1.1 import moneroComponents.NetworkType 1.0 import "../components" @@ -355,5 +356,35 @@ ColumnLayout { } } } + + RowLayout { + Layout.leftMargin: wizardLeftMargin + Layout.rightMargin: wizardRightMargin + Layout.topMargin: 50 * scaleRatio + Layout.alignment: Qt.AlignHCenter + Layout.fillWidth: true + visible: showAdvancedCheckbox.checked + + Text { + font.family: "Arial" + font.pixelSize: 16 * scaleRatio + color: "#4A4949" + text: qsTr("Number of KDF rounds:") + translationManager.emptyString + } + TextField { + id: kdfRoundsText + font.family: "Arial" + font.pixelSize: 16 * scaleRatio + Layout.preferredWidth: 60 + horizontalAlignment: TextInput.AlignRight + selectByMouse: true + color: "#4A4949" + text: persistentSettings.kdfRounds + validator: IntValidator { bottom: 1 } + onTextEdited: { + kdfRoundsText.text = persistentSettings.kdfRounds = parseInt(kdfRoundsText.text) >= 1 ? parseInt(kdfRoundsText.text) : 1; + } + } + } } diff --git a/wizard/WizardRecoveryWallet.qml b/wizard/WizardRecoveryWallet.qml index f30c9849..1e883b42 100644 --- a/wizard/WizardRecoveryWallet.qml +++ b/wizard/WizardRecoveryWallet.qml @@ -77,6 +77,7 @@ ColumnLayout { function recoveryWallet(settingsObject, fromSeed) { var nettype = appWindow.persistentSettings.nettype; + var kdfRounds = appWindow.persistentSettings.kdfRounds; var restoreHeight = settingsObject.restore_height; var tmp_wallet_filename = oshelper.temporaryFilename() console.log("Creating temporary wallet", tmp_wallet_filename) @@ -89,11 +90,11 @@ ColumnLayout { // From seed or keys if(fromSeed) - var wallet = walletManager.recoveryWallet(tmp_wallet_filename, settingsObject.words, nettype, restoreHeight) + var wallet = walletManager.recoveryWallet(tmp_wallet_filename, settingsObject.words, nettype, restoreHeight, kdfRounds) else var wallet = walletManager.createWalletFromKeys(tmp_wallet_filename, settingsObject.wallet_language, nettype, settingsObject.recover_address, settingsObject.recover_viewkey, - settingsObject.recover_spendkey, restoreHeight) + settingsObject.recover_spendkey, restoreHeight, kdfRounds) var success = wallet.status === Wallet.Status_Ok; -- cgit v1.2.3