Add display number of characters in passphrases (#5449)

Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
Bernhard Berg 2020-09-22 03:32:49 +02:00 committed by GitHub
parent d3747f40e2
commit ac5c1af829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 156 additions and 144 deletions

View File

@ -264,6 +264,8 @@ void PasswordGeneratorWidget::updatePasswordStrength(const QString& password)
if (m_ui->tabWidget->currentIndex() == Diceware) { if (m_ui->tabWidget->currentIndex() == Diceware) {
// Diceware estimates entropy differently // Diceware estimates entropy differently
health = PasswordHealth(m_dicewareGenerator->estimateEntropy()); health = PasswordHealth(m_dicewareGenerator->estimateEntropy());
m_ui->charactersInPassphraseLabel->setText(QString::number(password.length()));
} }
m_ui->entropyLabel->setText(tr("Entropy: %1 bit").arg(QString::number(health.entropy(), 'f', 2))); m_ui->entropyLabel->setText(tr("Entropy: %1 bit").arg(QString::number(health.entropy(), 'f', 2)));

View File

@ -708,175 +708,185 @@ QProgressBar::chunk {
<string>Passphrase</string> <string>Passphrase</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0"> <item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QGridLayout" name="gridLayout_3">
<item> <item row="2" column="1" alignment="Qt::AlignRight">
<layout class="QGridLayout" name="gridLayout_3"> <widget class="QLabel" name="labelWordSeparator">
<item row="0" column="1"> <property name="text">
<widget class="QComboBox" name="comboBoxWordList"> <string>Word Separator:</string>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> </widget>
<horstretch>0</horstretch> </item>
<verstretch>0</verstretch> <item row="0" column="1" alignment="Qt::AlignRight">
</sizepolicy> <widget class="QLabel" name="labelWordList">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Wordlist:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QSlider" name="sliderWordCount">
<property name="minimum">
<number>1</number>
</property> </property>
</widget> <property name="maximum">
</item> <number>40</number>
<item row="1" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="labelWordCount">
<property name="text">
<string>Word Count:</string>
</property> </property>
<property name="buddy"> <property name="value">
<cstring>spinBoxLength</cstring> <number>6</number>
</property>
<property name="sliderPosition">
<number>6</number>
</property> </property>
</widget>
</item>
<item row="4" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>8</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxWordCount">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>6</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1" alignment="Qt::AlignRight">
<widget class="QLabel" name="labelWordCount">
<property name="text">
<string>Word Count:</string>
</property>
<property name="buddy">
<cstring>spinBoxLength</cstring>
</property>
</widget>
</item>
<item row="4" column="1" alignment="Qt::AlignRight">
<widget class="QLabel" name="characterCountLabel">
<property name="text">
<string>Character Count:</string>
</property>
</widget>
</item>
<item row="3" column="1" alignment="Qt::AlignRight">
<widget class="QLabel" name="wordCaseLabel">
<property name="text">
<string>Word Case:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QComboBox" name="wordCaseComboBox"/>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>40</width>
<height>40</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="0" alignment="Qt::AlignRight"> </layout>
<widget class="QLabel" name="labelWordSeparator"> </item>
<property name="text"> <item row="2" column="2">
<string>Word Separator:</string> <layout class="QHBoxLayout" name="horizontalLayout_9">
</property> <item>
</widget> <widget class="QLineEdit" name="editWordSeparator">
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QComboBox" name="wordCaseComboBox"/>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QSlider" name="sliderWordCount">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>40</number>
</property>
<property name="value">
<number>6</number>
</property>
<property name="sliderPosition">
<number>6</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>8</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxWordCount">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>6</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="wordCaseLabel">
<property name="text">
<string>Word Case:</string>
</property>
</widget>
</item>
<item row="0" column="0" alignment="Qt::AlignRight">
<widget class="QLabel" name="labelWordList">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="text"> <property name="text">
<string>Wordlist:</string> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item>
<layout class="QHBoxLayout" name="horizontalLayout_9"> <spacer name="horizontalSpacer_7">
<item> <property name="orientation">
<widget class="QLineEdit" name="editWordSeparator"> <enum>Qt::Horizontal</enum>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <property name="sizeHint" stdset="0">
<horstretch>0</horstretch> <size>
<verstretch>0</verstretch> <width>40</width>
</sizepolicy> <height>20</height>
</property> </size>
<property name="minimumSize"> </property>
<size> </spacer>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="2">
<widget class="QComboBox" name="comboBoxWordList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="2" alignment="Qt::AlignLeft">
<widget class="QLabel" name="charactersInPassphraseLabel">
<property name="text">
<string>character</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="1" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>