- Compiler: g++ with C++17 support
- Operating System: Linux, macOS as described in requirements (can also run on windows with MinGW)
- Input File:
names.txtin the project root directory
project/
├── src/
│ ├── main.cpp # Program entry point
│ ├── file_handler/
│ │ ├── file_handler.hpp
│ │ └── file_handler.cpp # File I/O operations
│ ├── hash_table/
│ │ ├── hash_table.hpp
│ │ └── hash_table.cpp # Hash table implementation
│ ├── password_gen/
│ │ ├── password_gen.hpp
│ │ └── password_gen.cpp # Random password generation
│ └── vigenere/
│ ├── vigenere.hpp
│ └── vigenere.cpp # Vigenère cipher encryption
├── tests/
| ├── test_vigenere.cpp # Test Cipher
│
├── names.txt # Input file with userids
├── Makefile # Build configuration
└── README.md
makemake runmake clean- Ensure
names.txtexists in the project root with one userid per line - Run the program:
./project_runnerNo user interaction is required. The program runs automatically.
The program executes in three phases:
- Reads userids from
names.txt - Generates random 9-character lowercase passwords
- Writes userid/password pairs to
rawdata.txt - Encrypts passwords using Vigenère cipher with key "jones"
- Writes userid/encrypted password pairs to
encrypteddata.txt
- Reads
encrypteddata.txt - Inserts each userid/encrypted password pair into the hash table
- Uses external chaining to handle collisions
Tests 5 legal and 5 illegal password attempts using entries 1, 3, 5, 7, and 9 from rawdata.txt.
Legal Tests: Verifies correct passwords authenticate successfully.
Illegal Tests: Modifies the first character of each password to verify rejection.
- Type: Externally chained (array of linked lists)
- Size: 127 buckets (prime number for better distribution)
- Load Factor: Approximately 0.79 for 100 userids
- Hash Function: Sum of ASCII character values modulo table size
- Length: 9 characters
- Characters: Lowercase letters (a-z)
- Randomness: Mersenne Twister engine seeded with
std::random_device
- Key: "jones"
- Formula:
encrypted = (plaintext + key) mod 26 - Character Set: Lowercase letters only