Skip to content

Final Project – COAL, Summer 2023, FAST NUCES. Built Vigenère, ROT13, Rail Fence ciphers, and Diffie-Hellman in Irvine32 Assembly, showcasing low-level string handling and modular arithmetic.

License

Notifications You must be signed in to change notification settings

zubairahm3d/COAL-Cryptography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

COAL Cryptography Project

Overview

Final Project – Computer Organization and Assembly Language (COAL), Summer 2023, FAST NUCES. Implemented four cryptographic algorithms in Assembly using the Irvine32 library: Vigenère Cipher, Diffie-Hellman Key Exchange, ROT13, and Rail Fence Cipher. The project showcases low-level programming skills and fundamental cryptographic concepts.

Features

  • Algorithms:
    • Vigenere Cipher: Encrypts text using a keyword-based polybius square.
    • Diffie-Hellman Key Exchange: Computes public and shared keys for secure key exchange (fixed prime=23, base=5).
    • ROT13: Applies a Caesar cipher with a fixed shift of 13.
    • Rail Fence Cipher: Encrypts text in a two-rail zigzag pattern.
  • User Interface: Console-based menu to select and run each algorithm.
  • Input/Output: Accepts user input for text/keys and displays encrypted results or computed keys.

Prerequisites

  • MASM (Microsoft Macro Assembler) with Irvine32 library.
  • Windows operating system (Irvine32 is Windows-specific).
  • Visual Studio or another MASM-compatible assembler environment.

Installation

  1. Clone or download the repository.
  2. Obtain the Irvine32 library from Kip Irvine’s website or your course resources.
  3. Place Irvine32 files in the same directory as crypto.asm or configure your assembler to include them.
  4. Set up MASM in Visual Studio or your preferred assembler environment.

Usage

  1. Assemble and run crypto.asm using MASM on Windows.
  2. At the menu, select an option (1–5):
    • 1: Vigenere Cipher (enter text and key to encrypt).
    • 2: Diffie-Hellman Key Exchange (enter private keys for Alice and Bob).
    • 3: ROT13 (enter text to encrypt/decrypt).
    • 4: Rail Fence Cipher (enter text to encrypt with two rails).
    • 5: Exit.
  3. Follow prompts to input data and view results.
  4. Press any key to return to the menu.

File Structure

  • crypto.asm: Main Assembly script with cryptographic algorithms and menu logic.
  • README.md: This documentation file.

Implementation Details

  • Vigenere Cipher: Shifts alphabetic characters using a repeating key, mapped via a precomputed table.
  • Diffie-Hellman: Implements modular exponentiation for key exchange with hardcoded prime (23) and base (5).
  • ROT13: Shifts characters by 13 positions using the Vigenere table.
  • Rail Fence Cipher: Arranges text in a fixed two-rail pattern, printing rows sequentially.
  • Irvine32 Library: Handles console I/O (e.g., WriteString, ReadDec).

Limitations

  • Error Handling: Limited validation (e.g., no checks for non-alphabetic input or negative numbers).
  • Flexibility: Rail Fence Cipher is fixed to two rails; Diffie-Hellman uses static prime/base.
  • Portability: Windows-specific due to Irvine32 dependency.
  • Documentation: Code lacks extensive comments, though procedures are self-contained.

Future Improvements

  • Add input validation for non-alphabetic or invalid inputs.
  • Support variable rails in Rail Fence Cipher and configurable prime/base in Diffie-Hellman.
  • Include detailed inline comments for clarity.
  • Rewrite in a cross-platform language (e.g., C) for broader accessibility.

Acknowledgments

Developed as the final project for a COAL course to explore Assembly programming and cryptography. It leverages the Irvine32 library and course concepts.

License

Licensed under the MIT License.

Releases

No releases published

Packages

No packages published