Skip to content

MostafaOrabyX/C-Cipher-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

C Cipher Tool

Description

A simple command-line cipher tool that allows users to encrypt and decrypt text using a Caesar Cipher algorithm.


Features

  • Encrypts plaintext using Caesar Cipher
  • Decrypts ciphertext back to readable text
  • Handles invalid user input safely
  • Runs in a loop until the user chooses to exit

How It Works

  1. The program takes a text input (plaintext or ciphertext) and a numeric key (0–26)
  2. Each letter is shifted forward or backward in the alphabet based on the key
  3. The result is displayed to the user

How to Run

  1. Compile the program using c compiler : Example : gcc cipher-tool.c -o cipher-tool

  2. Run the program: ./cipher-tool


Example

Enter the first letter
Encrypt(E) or Decrypt(D): e
Text: Hello, world
Code: 7
Ciphertext: OLSSV, DVYSK
Do you want to encrypt or decrypt anything else (y/n): n


What I Learned

  • How to structure a C program using functions for better modularity
  • How to perform dynamic memory allocation using malloc and safely free memory using free
  • How to manipulate strings and process text character by character
  • How to validate user input and handle errors in a CLI program

Language Used

  • C

Author

Mostafa Oraby

About

A simple command-line C Cipher Tool that encrypts and decrypts text using the Caesar Cipher algorithm with a user-defined numeric key

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages