Git Product home page Git Product logo

old_ccipher's Introduction

Old CCipher

logo

Table of Contents

About the Project

Introduction

This project illustrates a basic C++ implementation of the Caesar Cipher Algorithm for the decryption of a specific hidden message for the CECS 4210 (Ethical Hacking) Course.

Getting Started

Prerequisites

In order to use this program some form of C++ Compiler must be installed. During the time this code was developed, Microsoft Visual Studio 2017 was used (link). It should be noted that the Microsoft Visual C++ package must be selected when installing the program.

Installation

After all is up an running, the only thing left to do is to open the Old_CCipher.cpp in the compiler and run it.

Usage

The Old_CCipher program can be divided into two (2) sections, where:

  1. The main will already include the encrypted message (enMsg) and the key (key) necesary to decrypt it. Furthermore, from here, the monoAlphabetic function will be called so to decrypt such encrypted message. The lines of code are shown below:
int main(){
    string enMsg = "frparnddlafmudkafcinnamifcaopmafpcasiqkacaqpnceaflikrtedqpfqdfckahvciaffdspcasiagiprcdrdnsidvkodrcgauuaqvncqepnnifmir";
    string key = "phqgiumeajlnofdybkrcvstxzw";

    cout << "Mono-Alphabetic Cipher\n\n";
    cout << "The encrypted message is: " << enMsg << endl << endl; 
    cout << "The decrypted message is: " << monoAlphabetic(enMsg,key) << endl; 
}
  1. As stated previously, the monoAlphabetic function will be tasked to decrypt the encrypted message; given that in order to do so it needs the message and key, it includes parameters for both. Furthermore, it utilizes two (2) variables, i.e.: alphabet and solution, to hold all letters of the English alphabet in order and the plaintext solution, respectively. Lastly, what follows are two nested for-loops for the generation of, well, the plaintext solution.
string monoAlphabetic(string enMsg, string key){
    const string alphabet = "abcdefghijklmnopqrstuvwxyz"; 
    string solution =""; 
    for(int i =0; i<enMsg.size();i++){
        for(int k = 0; k<key.size();k++){ 
            if(key[k] == enMsg[i]){ 
                solution = solution + alphabet[k]; 
            }
        }
    }
    return solution;
}

In all, the encrypted and decrypted messages are the following:

  • Encrypted Message: frparnddlafmudkafcinnamifcaopmafpcasiqkacaqpnceaflikrtedqpfqdfckahvciaffdspcasiagiprcdrdnsidvkodrcgauuaqvncqepnnifmir.
  • Decrypted (Plaintext) Message: nsaislookingforintelligentimaginativecriticalthinkerswhocancontributeinnovativeideastosolveourmostdifficultchallenges.

Acknowledgements

old_ccipher's People

Contributors

sergeant-potato avatar

Watchers

 avatar

Forkers

onurgezgin2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.