Different sites have different requirements for passwords, some of them have character limits. It would be interesting if the passphrase generator contained an option to control the character count instead of number of words.
This issue has already been highlighted at Request: Passphrase Generator dynamic character counter by @heavyboots and was later closed by @bw-admin without further comments.
As mentioned by @Pat-Rick on the aforementioned thread
Having that in mind, it’d be more appealing for users to have a generator that “chooses” the number of words. The generator could simply add words until the limit is reached and scrap the word out of bounds. Further entropy could be achieved by filling the remaining space with numbers or special characters at word bounds.
Example Implementation
Let’s say I want a 32 character passphrase:
We generate words and their separators until we get a string of size greater than 32. Let’s say we do that until we get empirical-ebook-unvented-deviancy
, which has 33 chars. Removing the last word we get empirical-ebook-unvented
, now we only have 24 chars, meaning we need 8 more characters to reach our goal. If we count the separator, we now require a word with 7 characters or fewer. Randomly picking a word, we get ranch
which has only 5 chars, getting us empirical-ebook-unvented-ranch
. This is good, but we are still missing two chars.
Now we need to fill in the remaining space, let’s roll dice! For each new character – which could 0-9 or a special character from the password char set – we currently have four different words it could be appended to. Having done that, we’ll have something like empirical5-ebook-unvented@-ranch
, which has exactly 32 characters just as we wanted!