Password Checker


Good passwords are an important part of life on the internet today. They can keep our computers secure and help us maintain our peace of mind knowing that our data is safe.

There are many guidelines available that help us make passwords that are difficult to guess. These guidelines can require a certain number of characters, symbols or numbers. They can also check for common words and patterns.

Password Checker

In this challenge you will be creating a password checker. Your password checker will be given a potential password. It will look for vulnerabilities in the password and determine if it passes or fails the test.

As always, the challenge is split into three levels. Please choose your level based on your available time and your comfort level with the challenge.

Level 1

For this level, write a program that will test a password to determine if it is at least 10 characters long.

Specifications

Given the password candidate, "password"

When it is checked by the program

Then the program will fail the password


Given the password candidate, "thisIsALongerPassword"

When it is checked by the program

Then the program will accept the password


Level 2

To complete level two, write a program that will check to make sure that the password is at least 10 characters and at least two of the following are true:

  • It contains both uppercase and lowercase letters
  • It contains numbers
  • It contains symbols such as punctuation

Specifications

Given the password candidate "thisIsALongerPassword"

When it is checked by the program

Then the program will fail the password


Given the password candidate "Unicorn!125"

When it is checked by the program

Then the program will accept the password


Level 3

For level three, meet the criteria for level 2 and also reject any candidates that contain common words.

Specifications

Given the password candidate "theThing!125"

When it is checked by the program

Then the program will fail the password


Given the password candidate "s#df4ghjKl;"

When it is checked by the program

Then the program will accept the password


More Information

This is meant as a coding exercise, so please don’t mistake any of these examples for good passwords.

Because of the importance of security, there is a lot of advice available on how to make a good password. Most people will agree that a good password contains many characters without any easily guessable patterns.

A note about specifications

Each level will contain one or more specifications. These specifications describe the level in a structured way. Each specification will have three parts starting with ‘given’, ‘when’, and ‘then’. Each of those parts has a specific purpose.

Given - This is where setup goes; it says what is expected to already exist.

When - Change happens here; this describes the action that is taken.

Then - Describes the results of the change.

The specification format comes from acceptance testing and behavior driven development.


Thank You For Your Participation

I hope that you enjoyed this challenge. If you are looking for additional CodeNewbie Challenges there is a list available on CodeNewbie Discourse.

Have an Idea for Challenge?

If you have an idea for a challenge, we would like to know about it. Please share your idea by posting it to the discourse thread.

Sharing your Solution

If you have created a solution to a challenge and have not yet shared it to CodeNewbie discourse, please do so. We have seen solutions in a variety of languages and styles and posted there and would love to see yours too.