Fall 2001 CSCI 333 Homework 6

This assignment is due Friday, 16 November.

In this assignment you will write a program that would be useful in checking for re-used passwords.

The task

Your program will use a file containing 1048576 bits, or 131072 bytes, to keep up with used passwords. Assume that this file is named password.dat and that initially all bits of the file are zero. Aslo, assume that your compiled program will be called passchck, or passchck.exe if you use Windows.

Your program is run from the command line by typing the command:

Your program will first hash password into a value b between 0 and 1048575. Then it will check if bit b of the file password.dat is 0 or 1.

If the bit is 0, your program reports that password is not in use. If the bit is 1, your program reports that password is in use. In either case, your program also sets bit b of password.dat to 1.

Turning in the assignment

You should email a copy of your completed code to the course instructor.

Useful utilities

The C++ program passmake.cpp will initialize the file password.dat, while the program passdump.cpp will read the file password.dat and count the number of one-bits in the file. Both programs have been successfully compiled under both Linux and Windows.