This project consists of three programs that work together to provide a basic encryption and decryption system using the Vigenère cipher, along with logging functionality.
os-project-1/
├── devlog.md # Development log with progress notes
├── driver.py # Main driver program to handle user interaction
├── encryption.py # Encryption and decryption using Vigenère cipher
├── logfile.txt # Output file for logging messages
├── logger.py # Logger program to write messages to logfile.txt
└── makefile # Simplified makefile for running the project
- Acts as the main interface for the user.
- Launches both the
logger.pyandencryption.pyprocesses usingsubprocess. - Manages user input to perform encryption, decryption, and password management.
- Supports maintaining an encryption/decryption history.
- Implements the Vigenère cipher for encryption and decryption.
- Accepts commands through standard input.
- Responds with results or error messages to standard output.
- Logs messages to the
logfile.txtwith timestamps. - Listens for input from the driver process and writes to the log file.
- A development log documenting the progress of the project.
- Stores log messages generated by
logger.py.
- Provides a convenient way to run the program.
- Ensure you are in the
anishg-git-os-project-1directory. - Run the following command using the makefile:
This is equivalent to:
make run
python driver.py logfile.txt
- Follow the prompts to interact with the program.
password: Set or update the encryption key.encrypt: Encrypt a string using the set password.decrypt: Decrypt a string using the set password.history: View the history of encrypted and decrypted strings.quit: Exit the program.
make run
Enter command (PASSWORD, ENCRYPT, DECRYPT, HISTORY, QUIT): INVALID CMD
Invalid command
Enter command (PASSWORD, ENCRYPT, DECRYPT, HISTORY, QUIT): PASSWORD
Enter passkey: SECRET
RESULT Password set
Enter command (PASSWORD, ENCRYPT, DECRYPT, HISTORY, QUIT): PASSWORD
Enter passkey:
ERROR Password not set, using previous password if one exists
Enter command (PASSWORD, ENCRYPT, DECRYPT, HISTORY, QUIT): ENCRYPT
Enter alphabetical string to encrypt: encrypt
RESULT WREICIL
Enter command (PASSWORD, ENCRYPT, DECRYPT, HISTORY, QUIT): DECRYPT
[0] Choose string from history
[1] Enter new string
Enter choice: 0
[0] ENCRYPT
[1] WREICIL
Enter choice: 1
RESULT ENCRYPT
Enter command (PASSWORD, ENCRYPT, DECRYPT, HISTORY, QUIT): HISTORY
HISTORY ['ENCRYPT', 'WREICIL']
Enter command (PASSWORD, ENCRYPT, DECRYPT, HISTORY, QUIT): QUIT
- Ensure that the log file (
logfile.txt) is accessible and writable. - The program maintains a simple in-memory history of strings encrypted or decrypted.
- Encryption and decryption only work with alphabetic strings (A-Z).
- I used Python 3.11.5