How to Generate Type-Friendly Password

For the life of me, I do not see why this is a thing for Korean websites and apps, but Korean apps often require “virtual keyboard” on a smartphone. Yes, you heard me correctly. On a smartphone’s virtual touchscreen keyboard, they insist to put in a new randomized keyboard for security sake, while banning the use of simple copy-paste or password manager. Not to mention the password policy of these apps often limit the length to either 8 characters in extreme cases and maybe 16 in some half-decent banks. KISA, Korea Internet & Security Agency, actually published an article NOT to use memorable passwords, such as “correct horse battery staple”. The lunacy!*

* It wouldn’t have worked even if the agency didn’t have such a policy, since that exemplary password is already 28 characters long.

Regardless, I need these apps on smartphones. —who doesn’t hate an app from banks anyway— That means I needs to generate a password that is random, but still ‘type-friendly’ for smartphones.

If you randomly generate 16 characters long random password on a password manager, it will generate the safest string, just not type-friendly. Also, Korean apps often have its own quirky limit on what counts as special characters, so we need to chance that.

Instructions

For the obvious reasons, this is not the safest password you can have. I wanted a password that is as random as possible within some humane convenience. I wrote the script in Python yet again, so it is possible to run it on smartphones or computers, locally.

# !/usr/bin/env python3
	
import secrets
import string

set_length = 4
special_character_permitted = ['!','@','#','$', '^', '&']

string_mix = [string.ascii_lowercase, 
	string.ascii_uppercase, 
	string.digits, 
	string.punctuation,
	special_character_permitted
	]
pattern = []

set_mix = ['lowercase', 'uppercase', 'digits', 'special']
set_pattern = []

for idx in string_mix:
	pattern.append('\n')
	for iidx in range(set_length):
		pattern.append(secrets.choice(idx))

for idx in range(len(set_mix)):
	n = secrets.choice(set_mix)
	set_pattern.append(n)
	set_mix.remove(n)

print(*pattern, sep='')
print(*set_pattern, sep='-')

The code, at default value, will generate 4 characters long for each lowercase, uppercase, digits, special characters, permitted special characters strings. For example it might print:

idqe
SHHH
8364
>[(/
@@#!
lowercase-digits-special-uppercase

Obviously you don’t have to use all of them, and you don’t have to follow the sequence the script is printing. The key idea is that it is easier to type one set of characters (e.g. uppercase) before going to another (e.g. special characters). So, in this example, your password might be: idqe8364>[(/SHHH. Again, you don’t have to follow the script to the letter. You could pick 3 characters from lowercase, 4 characters from digits, and so on, in a sequence that is different from what is randomly generated.

There are two values you could adjust: set_length, and special_character_permitted. Changing the length will create either shorter or longer string per set, and changing the permitted characters will affect what sets of special characters the script will use. 4th column is for all special characters (i.e. punctuations) and 5th column is the one affected.

Leave a comment