Re: prompt_password()
- Posted by wynco Jul 03, 2012
- 1272 views
The encryption program I am writing is a windows program, so I don't if it applies directly to this discussion.
The way I am handling passwords is to use normal EditText fields and intercept the keys as they are typed.
The program has a number of Ctrl and Alt hot keys, so I did not want to use any modified characters in the passwords. This limited the number of characters that could be entered to approximatly 95 from a standard windows keyboard. This was not acceptable, so what I done was added a toggle to turn ON/OFF an extended character set using Ctrl+E or by a popup menu. When extended characters is on, I remap characters from 32 to 127 to two different groups in the 128 to 255 range, so typing 'a' with extended on enters a keycode 227 and 'A' enters 159 and so on. This allows 190 characters using only the normal 'typewriter' type keys.
There is also a Hide/Show characters toggle (Ctrl+*) to show the actual characters typed or show all asterisks. 'Show characters' can be toggled off whether the fields are empty or not, however it cannot not be toggled on unless both password fields are empty.
The fields allow 1 to 32 character passwords, I don't want to police minimum password lengths, so I leave it up to the user to enter secure passwords.
All passwords are expanded to 32 characters during the encryption process.
More to the point, how about expanding the dispsym flag to display either astericks or random characters, such as
integer dispsym = "*" for astericks or
integer dispsym = "r" for random, as Andy suggested
and another flag to return the raw characters typed or a more secure encoded password, such as
integer dispsym = "r" for raw or
integer dispsym = "e" for encoded as Derek suggested