As you may know, hackers are everywhere and they want to hack everything. You were asked to make password requirements which will stop any hacker. The problem is, that your boss has heard that paying for LOC is evil and he pays you $1800 - $0.03 * characters inserted per month to make you write simplest thing which possibly could work. So, you have to use small number of characters (hopefully very small), or otherwise forget about cash. Also, your boss doesn't care what language you will use.
The requirements for good passwords are similar to those in mentioned article, except the dictionary based requirements were removed to avoid making solution depend on external files, you don't have to check for letters being rearranged (Hard to understand what it actually means), last rule is removed (What is 3/4?) and it doesn't check old passwords.
The exact requirements after removing certain requirements from linked article are:
- have at least 8 character(s)!
- not be longer than 12 characters!
- have upper and lower case characters!
- have no more than 8 upper-case letter(s)!
- have no more than 8 lower-case letter(s)!
- have at least 2 letter(s)!
- have a leading letter!
- have at least 1 digit(s)!
- not be your username!
- not be your username backwards!
- not contain your username!
- not contain your username backwards!
- have no more than 1 pair(s) of repeating characters!
- not have 3 occurences of the same character!
- not contain carat (^)
- not contain space
- not contain =
- not conatain &
- not contain #
- not contain ,
- not conatain ;
- not contain "
- not contain >
- not contain <
- not contain [
- not contain |
- not contain )
All misspellings on this list were left as is.
$ ./checkpass Username: John Password: L!]E2m69 OK. $ ./checkpass Username: John Password: JohnnhoJ12 Nope. $ ./checkpass Username: JOE.smith Password: JOE!smith123 OK.
The shortest code wins money (sent as JPG file). It has to show "Username: " and "Password: " prompts and reply with exact message.