Skip to content

donsteponmyeezy/hash-table-password-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Manual: Hash Table Password System

Requirements

  • Compiler: g++ with C++17 support
  • Operating System: Linux, macOS as described in requirements (can also run on windows with MinGW)
  • Input File: names.txt in the project root directory

Project Structure

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

Building the Project

Compile

make

Compile and Run

make run

Clean Generated Files

make clean
  1. Ensure names.txt exists in the project root with one userid per line
  2. Run the program:
./project_runner

No user interaction is required. The program runs automatically.


Program Output

The program executes in three phases:

Phase 1: File Generation

  • 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

Phase 2: Hash Table Construction

  • Reads encrypteddata.txt
  • Inserts each userid/encrypted password pair into the hash table
  • Uses external chaining to handle collisions

Phase 3: Authentication Testing

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.

Technical Details

Hash Table

  • 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

Password Generation

  • Length: 9 characters
  • Characters: Lowercase letters (a-z)
  • Randomness: Mersenne Twister engine seeded with std::random_device

Vigenère Cipher

  • Key: "jones"
  • Formula: encrypted = (plaintext + key) mod 26
  • Character Set: Lowercase letters only

About

Project 1 for data structures and algorithms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors