A comprehensive encryption and decryption program developed entirely in Assembly Language using XOR bitwise operations. This project demonstrates secure data handling, file I/O operations, and low-level programming concepts in a user-friendly console interface.
- Overview
- Features
- Technical Specifications
- Program Functionality
- Installation & Setup
- Usage Guide
- File Structure
- Technical Implementation
- Deployment
- Troubleshooting
- Contributing
- License
- Author
- Acknowledgments
The Encryption-Decryption project is a semester project that showcases the power of Assembly Language in implementing cryptographic operations. Built using MASM615, this program provides a complete solution for encrypting text data using XOR operations and storing it securely in files.
- Pure Assembly Language Implementation: Demonstrates low-level programming expertise
- XOR Encryption Algorithm: Simple yet effective symmetric encryption
- File-based Data Persistence: Secure storage and retrieval of encrypted data
- Interactive Menu System: User-friendly console interface
- Educational Value: Perfect for understanding encryption concepts and Assembly programming
- 🔐 Data Encryption: Encrypt text strings using XOR bitwise operations
- 🔓 Data Decryption: Decrypt and view original data seamlessly
- 💾 File Operations: Store encrypted data in files (
MICHU.txt
) - 👁️ Data Visualization: Display encrypted data in its raw form
- 🗑️ Data Management: Delete stored encrypted data
- 📋 Menu-Driven Interface: Easy-to-use console navigation
- ⚡ Fast Processing: Optimized Assembly code for efficient execution
- 🔄 Session Management: Continue operations until user exits
Specification | Details |
---|---|
Language | Assembly Language (MASM615) |
Architecture | x86 (16-bit) |
Memory Model | Small Model |
Stack Size | 100h bytes |
Encryption Method | XOR Bitwise Operation |
File Format | Plain text (.txt) |
Platform | DOSBox recommended |
Assembler | MASM615 |
The program offers five main operations through an interactive menu:
----------------------------------
1-ADD Data in Encrypted file
2-Read decrypted data
3-show Data from Encrypted file
4-Delete Data from Encrypted file
5-Exit Program
----------------------------------
- Prompts user to enter a string
- Applies XOR encryption (key: 1)
- Stores encrypted data in
MICHU.txt
- Confirms successful encryption
- Reads encrypted data from file
- Applies XOR decryption to restore original text
- Displays the decrypted string on screen
- Reads and displays raw encrypted data
- Shows the actual encrypted bytes stored in file
- Useful for understanding encryption results
- Allows user to specify file for deletion
- Creates user-defined files for data management
- Provides file creation confirmation
- Safely terminates the application
- Cleans up resources and memory
-
DOSBox Emulator
- Download from dosbox.com
- Install and configure DOSBox on your system
-
MASM615 Assembler
- Ensure MASM615 is available in your DOSBox environment
- Set up proper PATH variables for MASM tools
-
Clone the Repository
git clone https://github.com/chmuhammadasim/Encryption-Decryption-masm615.git cd Encryption-Decryption-masm615
-
Mount Directory in DOSBox
mount c: /path/to/project/directory c:
-
Compile the Program
masm asim.asm link asim.obj
-
Run the Executable
asim.exe
- Launch the compiled executable
- The program displays a welcome screen with menu options
- Enter your choice (1-5) when prompted
-
Encrypt Data:
- Select option
1
- Enter your text string
- Program encrypts and saves to file
- Select option
-
View Encrypted Data:
- Select option
3
- View the raw encrypted content
- Select option
-
Decrypt Data:
- Select option
2
- See your original text restored
- Select option
-
Exit:
- Select option
5
to terminate
- Select option
Enter Option : 1
Enter String 1: Hello World
Your data has been encrypted!
Enter Option : 3
encrypted Data: Ifmmp!Xpsme
Enter Option : 2
decryption: Hello World
Encryption-Decryption-masm615/
├── asim.asm # Main assembly source code
├── asimlib.lib # Assembly library file
├── README.md # Project documentation
├── LICENSE # MIT License file
├── MICHU.txt # Generated encrypted data file (runtime)
└── .gitattributes # Git configuration
asim.asm
: Core implementation containing all procedures and program logicasimlib.lib
: External library providing additional assembly functionsMICHU.txt
: Default output file for storing encrypted data (created at runtime)
The program uses a simple XOR cipher with key value 1
:
encryption proc near
mov dx,offset mybuf1
mov ah, 3Fh
int 21h
mov cx,lengthof mybuf1
mov bx,0
l1:
xor mybuf1[bx],1 ; XOR each byte with 1
inc bx
loop l1
ret
encryption endp
-
Data Structures:
- Menu strings for user interface
- Input/output buffers (100 bytes)
- File handle management
- User choice storage
-
File Operations:
- File creation and opening
- Reading and writing encrypted data
- Proper file handle management
-
Memory Management:
- Register clearing procedures
- Stack and data segment setup
- Buffer management
- XOR with key
1
: Simple encryption suitable for educational purposes - File-based storage: Data persists between program sessions
- Memory clearing: Registers are cleared after operations
For optimal deployment and execution:
- Recommended Platform: DOSBox v0.74 or higher
- Assembler: MASM615 (Microsoft Macro Assembler)
- Memory Requirements: Minimal (16-bit addressing)
- Storage: Small footprint (~10KB for source files)
# Step 1: Assemble source code
masm asim.asm;
# Step 2: Link object file
link asim.obj;
# Step 3: Run executable
asim.exe
The compiled executable (asim.exe
) can be distributed independently with DOSBox for cross-platform compatibility.
-
"File not found" error
- Ensure
asimlib.lib
is in the same directory - Check file permissions
- Ensure
-
Compilation errors
- Verify MASM615 is properly installed
- Check syntax and include paths
-
Runtime crashes
- Ensure sufficient memory in DOSBox
- Check stack size configuration
-
File access issues
- Verify write permissions in directory
- Check if
MICHU.txt
is locked by another process
- Use DOSBox's debug mode for step-by-step execution
- Check register values during encryption/decryption
- Verify file contents with hex editor
Contributions are welcome! Here's how you can help:
- Fork the Repository
- Create a Feature Branch
git checkout -b feature/amazing-feature
- Make Your Changes
- Follow assembly coding conventions
- Add comments for complex operations
- Test thoroughly in DOSBox
- Commit Your Changes
git commit -m 'Add amazing feature'
- Push to Branch
git push origin feature/amazing-feature
- Open a Pull Request
- Maintain code readability and documentation
- Test all changes in DOSBox environment
- Follow existing code style and structure
- Update README if adding new features
This project is licensed under the MIT License - see the LICENSE file for details.
Muhammad Asim Chattha
- GitHub: @chmuhammadasim
- Institution: Air University, Islamabad, Pakistan
- Field: Computer Science Student
Hello, I'm Muhammad Asim Chattha, a dedicated Computer Science student currently pursuing my studies at Air University in Islamabad, Pakistan. This Encryption-Decryption project represents my semester work, showcasing expertise in Assembly Language programming and cryptographic concepts.
This project is not just a coding exercise but a journey into the realm of secure data handling through the ingenious use of XOR bitwise operations, demonstrating the power and precision of low-level programming.
- Air University - For providing the educational foundation
- Assembly Language Community - For continuous learning resources
- DOSBox Development Team - For maintaining compatibility
- Open Source Community - For inspiration and collaboration opportunities
Feel free to explore, contribute, and delve into the fascinating world of assembly language and encryption! ⚡🔐