Flag
- A flag defines what charset is going to be used to generate a password
- This charset is also called generation charset
- The generator recognizes only valid flags
- To be valid a flag must contain only the following symbols (a.k.a. requested symbols):
l,d,s,c- and begin with a dash (or two:-ddor--dd)-
l = Latin: adds
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZto the charset -
d = Digits: adds
0123456789to the charset -
s = Special characters: adds
~!@#$%^&*()_+-='\"|/.?,to the charset -
c = Cyrillic: adds
абвшдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯto the charsetExample 1:
--lsdor-dslare valid flags, while-fslor--djioare notExample 2: with the flag
--lsdthe charset will contain latin chars, cyrillic chars and digits
-
- An order of the symbols in a valid flag is not important:
--lsdwill generate the same charset as--sldor--dls - Requested symbols may be present in a valid flag more than once:
--lsdis simmilar to--llsdor--llssdddNB: adding requested symbols into a valid flag more than once WILL increase the chance of the symbols from the corresponding alphabet to be added
- Command may contain more than one valid flag:
--lsdcreates the simmilar charset as--lsd -lsor-sd --llNB: usage of the requested symbol in multiple flags WILL increase the chance of the symbols from corresponding alphabet too.
- Usage of invalid flags is allowed too. However such flags will not affect the generation charset:
-dqwor--fsddo not define the charset. - If no valid flag is passed then the generation charset contains only latin chars and digits (like if the
-ldflag was used).
Password's length
- Length is a number and is passed like if it was a flag (though without dashes).
Example:
npx . --sd 50will generate password 50 chars long. - Valid length contains only digits:
npx . --sd 50is fine, whilenpx . --sd 50jis not. - Valid length may be passed before, after or even between flags (any flags, since invalid will not be recognized).
Example:
npx . 50 --dsor evennpx . -d -sss - qwaw 50 -lsd -lllsis fine. - Only the first valid length will be recognized:
npx . 50 5 -lsdwill generate a password of 50 chars, not of 5. - If no valid length is passed then a generated password will contain 20 characters.
Installation & usage:
- Clone this repository.
Cdto the newly created directory.- To generate a password run
npx . [flag] [length]