Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project: Encryption and Logging System

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.

Directory Structure

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

Program Descriptions

1. driver.py

  • Acts as the main interface for the user.
  • Launches both the logger.py and encryption.py processes using subprocess.
  • Manages user input to perform encryption, decryption, and password management.
  • Supports maintaining an encryption/decryption history.

2. encryption.py

  • Implements the Vigenère cipher for encryption and decryption.
  • Accepts commands through standard input.
  • Responds with results or error messages to standard output.

3. logger.py

  • Logs messages to the logfile.txt with timestamps.
  • Listens for input from the driver process and writes to the log file.

4. devlog.md

  • A development log documenting the progress of the project.

5. logfile.txt

  • Stores log messages generated by logger.py.

6. makefile

  • Provides a convenient way to run the program.

How to Run

  1. Ensure you are in the anishg-git-os-project-1 directory.
  2. Run the following command using the makefile:
    make run
    This is equivalent to:
    python driver.py logfile.txt
  3. Follow the prompts to interact with the program.

Available Commands

  • 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.

Sample run

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

Notes

  • 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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages