Coder Social home page Coder Social logo

seigtm / strategyfileencrypter Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 1.0 9 KB

An example of text files encryption using the strategy design pattern.

C++ 100.00%
text-encryption encryption-strategies hierarchy encryption encryption-decryption encrypt encryption-algorithms cipher cipher-algorithms text-cryptography

strategyfileencrypter's Introduction

Text files encryption using strategy design pattern in C++.

This source code is a template of using the strategy design pattern for text files encryption in C++.
This project is a homework from my college programming teacher.

Problem statement:

Develop the program for encrypting text documents.
The user enters a string containing the path to the text file ("C:/example.txt").
After that, he enters a number from 1 to 3 to clarify the text encryption method.
After the selected algorithm works, the encrypted text is saved to another file ("C:/example_ciphered.txt").
Develop the console application that implements the described functionality and contains a hierarchy of encryption classes.
Justify the selected class hierarchy and the selected design pattern.

Implementation:

A basic virtual class for std::string encryption strategies:

class EncryptionStrategy
{
public:
    virtual std::string encrypt(const std::string &text, const std::string &key = "") = 0;
    virtual std::string decrypt(const std::string &text, const std::string &key = "") = 0;
};

Concrete encryption strategy using XOR:

class XOREncryptionStrategy : public EncryptionStrategy ...

Concrete encryption strategy using Caesar:

class CaesarEncryptionStrategy : public EncryptionStrategy ...

Concrete encryption strategy using Binary code:

class BinaryEncryptionStrategy : public EncryptionStrategy ...

Interface for file encryption using encryption strategies:

class IFileEncryptor ...

strategyfileencrypter's People

Contributors

seigtm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

aiwakhalil

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.