Skip to content

Add support for extended ASCII in password generator#538

Merged
TheZ3ro merged 3 commits intodevelopfrom
feature/extendedAscii
May 1, 2017
Merged

Add support for extended ASCII in password generator#538
TheZ3ro merged 3 commits intodevelopfrom
feature/extendedAscii

Conversation

@TheZ3ro
Copy link
Copy Markdown
Contributor

@TheZ3ro TheZ3ro commented Apr 28, 2017

Resolve #343

Description

This adds support for extended ASCII character in the password generator, like KeePass.

How has this been tested?

Manually and with Travis

Screenshots (if appropriate):

istantanea_2017-04-28_22-05-01

Types of changes

  • ✅ New feature (non-breaking change which adds functionality)

Checklist:

  • ✅ I have read the CONTRIBUTING document. [REQUIRED]
  • ✅ My code follows the code style of this project. [REQUIRED]
  • ✅ All new and existing tests passed. [REQUIRED]
  • ✅ I have compiled and verified my code with -DWITH_ASAN=ON. [REQUIRED]

m_ui->checkBoxUpper->setChecked(config()->get("generator/UpperCase", true).toBool());
m_ui->checkBoxNumbers->setChecked(config()->get("generator/Numbers", true).toBool());
m_ui->checkBoxSpecialChars->setChecked(config()->get("generator/SpecialChars", false).toBool());
m_ui->checkBoxExtASCII->setChecked(config()->get("generator/EASCII", false).toBool());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheZ3ro I think we could call this one checkBoxExtendedASCII or checkBoxEASCII

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@louib isn't Ext an abbreviation for Extended? I will change this to checkBoxExtendedASCII if Ext don't fit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheZ3ro I don't mind the extra characters to make it explicit, but maybe that's just me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote for the name as is. It's descriptive to me.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @louib too. Less confusion that way.

@louib
Copy link
Copy Markdown
Member

louib commented Apr 28, 2017

@TheZ3ro I guess we could also blacklist those, yeah.
Is there any unit tests to add? I don't see a test file for password generators.

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Apr 28, 2017

@louib I was also wondering about what to do. I think we can add a new test file for them

@louib
Copy link
Copy Markdown
Member

louib commented Apr 30, 2017

@TheZ3ro also, I searched for look-alike inside of the EASCII group, but I did not pay attention to possible look-alike across groups with EASCII enabled, which the other classes seem to be handling. So we should see if there's any more look-alikes to exclude.

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Apr 30, 2017

@louib this is the code for EASCII and SpecialChar from KeePass source:

if(m_strHighAnsi == null)
{
	StringBuilder sbHighAnsi = new StringBuilder();
	// [U+0080, U+009F] are C1 control characters,
	// U+00A0 is non-breaking space
	for(char ch = '\u00A1'; ch <= '\u00AC'; ++ch)
		sbHighAnsi.Append(ch);
	// U+00AD is soft hyphen (format character)
	for(char ch = '\u00AE'; ch < '\u00FF'; ++ch)
		sbHighAnsi.Append(ch);
	sbHighAnsi.Append('\u00FF');

	m_strHighAnsi = sbHighAnsi.ToString();
}

if(m_strSpecial == null)
{
	PwCharSet pcs = new PwCharSet(false);
	pcs.AddRange('!', '/');
	pcs.AddRange(':', '@');
	pcs.AddRange('[', '`');
	pcs.Add(@"|~");
	pcs.Remove(@"-_ ");
	pcs.Remove(PwCharSet.Brackets);

	m_strSpecial = pcs.ToString();
}

This is the only look alike

public const string LookAlike = @"O0l1I|";

Numbers = 0x4,
SpecialCharacters = 0x8,
EASCII = 0x16
EASCII = 0x10
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheZ3ro 😮 my bad, nice catch!

@droidmonkey droidmonkey added this to the v2.2.0 milestone Apr 30, 2017
@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Apr 30, 2017

@louib how do you think we should test the password generator? Generating random password and checking if they respect the char restriction from their groups?

Generating one password doesn't really tell you if the generator is working properly (maybe the output password is valid only because it didn't selected an invalid char for this specific generation)
Should I generate N password?

And also, the restriction checking mechanism is based on the generator itself so it will pass the tests also in case where it should fail.

Do we need tests for the generator itself?

@louib
Copy link
Copy Markdown
Member

louib commented May 1, 2017

Generating random password and checking if they respect the char restriction from their groups?

Pretty much what I was thinking, but I guess we can go ahead without testing this.

@TheZ3ro TheZ3ro changed the title WIP: Add support for extended ASCII in password generator Add support for extended ASCII in password generator May 1, 2017
@TheZ3ro TheZ3ro merged commit 7040bef into develop May 1, 2017
@TheZ3ro TheZ3ro deleted the feature/extendedAscii branch May 1, 2017 16:14
droidmonkey added a commit that referenced this pull request Jun 25, 2017
- Added YubiKey 2FA integration for unlocking databases [#127]
- Added TOTP support [#519]
- Added CSV import tool [#146, #490]
- Added KeePassXC CLI tool [#254]
- Added diceware password generator [#373]
- Added support for entry references [#370, #378]
- Added support for Twofish encryption [#167]
- Enabled DEP and ASLR for in-memory protection [#371]
- Enabled single instance mode [#510]
- Enabled portable mode [#645]
- Enabled database lock on screensaver and session lock [#545]
- Redesigned welcome screen with common features and recent databases [#292]
- Multiple updates to search behavior [#168, #213, #374, #471, #603, #654]
- Added auto-type fields {CLEARFIELD}, {SPACE}, {{}, {}} [#267, #427, #480]
- Fixed auto-type errors on Linux [#550]
- Prompt user prior to executing a cmd:// URL [#235]
- Entry attributes can be protected (hidden) [#220]
- Added extended ascii to password generator [#538]
- Added new database icon to toolbar [#289]
- Added context menu entry to empty recycle bin in databases [#520]
- Added "apply" button to entry and group edit windows [#624]
- Added macOS tray icon and enabled minimize on close [#583]
- Fixed issues with unclean shutdowns [#170, #580]
- Changed keyboard shortcut to create new database to CTRL+SHIFT+N [#515]
- Compare window title to entry URLs [#556]
- Implemented inline error messages [#162]
- Ignore group expansion and other minor changes when making database "dirty" [#464]
- Updated license and copyright information on souce files [#632]
- Added contributors list to about dialog [#629]
@phoerious phoerious added pr: new feature Pull request adds a new feature and removed new feature labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: new feature Pull request adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for high ANSI characters in the password generator

5 participants