Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description To calculate the password strength, first the user will provide their password and you will calculate how strong that password is based on two

Description

To calculate the password strength, first the user will provide their password and you will calculate how strong that password is based on two main parameters: length of the password (number of characters), and the size of the character pool.

You will need to build your password/passphrase character by character until you hit a newline. As you are building the password phrase, each character added to the string will need to be analyzed. Your character pool will start at zero.

For each entered character, you will determine if it is a lowercase character, an uppercase character, a digit, a blank character (space or tab) or a punctuation character. If the type has not been used yet, you will add the number of possible characters in that type into the pool, according to the following table:

Type of character

Examples

# of possible characters

Lower case letters

abcdexyz

26

Uppercase letters

ABCDXYZ

26

Digits (numbers)

0123456

10

Punctuation symbols

!@#$^&*

32

Blank

space/tab

2

Note that, if a lowercase character is encountered, 26 will be added to the character pool regardless of how many lowercase characters are in your password / passphrase. This is true for each of the classifiers above. If a punctuation is added, 32 characters are added into the character pool.

For example, if the user typed the password thisisFun, the character pool will have 52 (26 for lowercase letters + 26 for uppercase letters).

Then, you will calculate the bits of entropy by taking the log2(character_pool)image text in transcribed . The function log2 is available in the cmath library. An example call would look like entropy_bits = log2( character_pool);

Your password/passphrase entropy can then be computed by taking the entropy bits and multiplying it by the number of characters in the password / passphrase. The following table describes the password / passphrase entropy based on its complexity.

Entropy

Complexity

Very weak

[45-52)

Weak

[52-72)

Reasonable

[72-127)

Strong

>= 127

Very strong

Determining character type

There are functions in the cctype library to help with this. Each function will return true if it matches a character type and false if it does not.

Assume a variable has been declared of type char with an identifier name of ch. (char ch;)

You will use the following functions from cctype:

  • islower will evaluate a character that has been passed in and will return true if it is a character a z inclusive. It will return false if it is not a lower-case character. There are 26 lower case characters.

Example call if( islower( ch ) )

  • isupper will evaluate a character that has been passed in and will return true if it is a character A Z inclusive. It will return false if it is not an upper-case character. There are 26 upper case characters.

Example call if( isupperr( ch ) )

  • isdigit will evaluate a character that has been passed in and will return true if is a character 0 9 inclusive. It will return false if it is not a digit. There are 10 digit characters.

Example call if( isdigit( ch ) )

  • isblank will evaluate a character that has been passed in and will return true if is a space or a tab character. It will return false if it is not a space or a tab character. There are two blank characters

Example call if( isblank( ch ) )

  • ispunct will evaluate a character that has been passed in and will return true if it is a punctuation character and false if it is not. There are 32 punctuation character.

Example call if( ispunct( ch ) )

Requirements:

  • Allow a user to type a password or phrase. You will evaluate each character to compute the character pool count, until Enter key is hit.
  • You must use the functions from the cctype library and the log2 from the cmath library.
  • You should not worry or deal with other character types.
  • When done computing everything output the following data. The entropies should be real numbers displayed with 2 digits of precision.
  • Use the exact phrase for output.

Password checker

Enter password/passphrase:

Password:

Character pool: ###

Password size: ###

Entropy bits per character: #.## Password entropy value: ###.##

Password strength:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions