#include #include #include #define RECSIZ 1024 #define NUMREC 128 #define FILNAME "password.dat" #define NUMBITS (RECSIZ * NUMREC * 8) // The following function must be provided unsigned int hashIt(char *P) ; void main(int argc, char *argv[]) { unsigned char updBuff ; fstream updStream(FILNAME, ios::in | ios::out | ios::binary) ; if (!updStream) { cerr << "Unable to open " << FILNAME << endl ; exit(1) ; } if (argc < 2) { cerr << "No new password given" << endl ; exit(1) ; } unsigned int hashNum = hashIt(argv[1]) % NUMBITS ; unsigned int hashBytpos = hashNum/8 ; // byte position unsigned int hashBitpos = hashNum%8 ; // bit position within byte int bitMask = 1<