While I'm not sure setting a default password is a desirable action (people often don't know how to change it and then forget it) if I were doing this, I would get a load of wordlists in various languages and pick perhaps two random words, concatenate and use that as the password.
Means you'll have to do some leg work to find the wordlists but it should be a fairly simple process once you've got them.
Edit: If you're just making random strings, it gets a lot simpler: you just store a file of available characters for each language. Open the right one when you come to generate and then pick random letters. Bish bash bosh. Done.
Edit 2: As Marcelo correctly commented, you could run into the problem of generating some obscene password for the user. It might be worth also keeping localised blacklisted strings to check your password for. If any of the strings appear in the password (just in it, not the whole thing), generate a different password. This does mean you'll never generate an innocent enough password like scunthorpe
but it also means you won't get things like assclown
slipping through either.
As you may have gathered, this is starting to look like a lot of work:
- Get all the valid characters for every language you plan to support
- Get all the obscene words for every language you plan to support
- Generate a password based on the letters
- Check none of them contain a swear word
- Remember that some obscene words are adopted by other languages but might not feature on language-specific blacklists so keep an international black-list too.
You might find that setting a pass-phrase using known clean words from each language (per my original answer) works better.
If all that looks too stressful, you might be better off re-adjudicating the reason for setting a random password in the first place. If it's an email-verification device, there are other, easier methods to use. Eg: sending a unique link to be clicked
Edit: Would numbers be okay? They're a lot safer, don't need combing, are international and can be long enough to be unique, they're just rarely memorable. If they're one-off copy-and-paste jobs, they should do you fine.
If you need them to be short but highly unique (and need lots) perhaps mixing numbers with letters in predictable patterns like (a
= letter, n
= number) annn-annn
gives 676,000,000 combinations. Even simple things like annn
give enough to not be guessed (26000 combos) if they don't need to be unique... If these are passwords, there's nothing wrong with two being the same.