Project01 - Password Checker
Due:
Mon, Feb 14, 2022 at 11:59 PM
to Github Classroom Assignment
Background
Passwords are a fundamental part of computer security. In this assignment, we will explore some common ways to attack passwords, and techniques for measuring the randomness (entropy) of a password.
Requirements
- You will develop a C program which checks a given password (at most 64 characters) against a list of common passwords:
- Is the password on a list of 10,000 common passwords?
- Is the password one of those passwords, after substituting common “l33t speak” transformations like ‘e’ to ‘3’
- Is the password one of those passwords, including a ‘1’ at the end?
- Your program will calculate the number of bits of entropy for the given password, using the algorithm given below.
- Your program will be built by a
Makefile
you provide.
Given
- The GitHub Classroom Assignment contains a file called
passwords.c
which defines the list of 10,000 common passwords - Although there are a large number of l33t substitutions, we will use these common ones:
- Change ‘0’ to ‘o’
- Change ‘3’ to ‘e’
- Change ‘!’ to ‘i’
- Change ‘@’ to ‘a’
- Change ‘#’ to ‘h’
- Change ‘$’ to ‘s’
- Change ‘+’ to ‘t’
- The test case for plus1 is separate from the test case for l33t, so yankees1 should match yankees, but y@nk33s1 should not match yankees.
- The number of bits of entropy is given by the equation:
log2(number_of_possible_characters ^ length_of_password)
- To calculate the number of possible characters, you should loop over the password, increasing the number as shown:
- Add 26 if a lower case character is present
- Add 26 if an upper case character is present
- Add 10 if a digit is present
- Add 32 if a printable (use C
isprint()
fromctype.h
) is present but is not upper case, lower case, or a digit
log2(n)
(log base 2) is given bylog(n) / log(2)
- In order to use the C
log()
function, you’ll need to#include <math.h>
and link the executable withgcc -lm
Example Output
phpeterson@vlab00:project01 $ ./project01 10k foobar
10k: match
phpeterson@vlab00:project01 $ ./project01 10k foobaz
10k: no match
phpeterson@vlab00:project01 $ ./project01 l33t y@nk33s
l33t: match
phpeterson@vlab00:project01 $ ./project01 plus1 yankees1
plus1: match
phpeterson@vlab00:project01 $ ./project01 entropy "purple cow stapler mouse"
bits of entropy: 140
Rubric
- 50 pts: passes 10k tests
- 10 pts: passes 10k-l33t tests
- 10 pts: passes 10k-plus1 tests
- 20 pts: passes entropy tests
- 10 pts: readable coding style, no build products in repo