Skip to content
/ RSA Public

The algorithm allows you to encrypt and decrypt a message using RSA

Notifications You must be signed in to change notification settings

Vaynbaum/RSA

Repository files navigation

RSA

The algorithm allows you to encrypt and decrypt the message.


How to use

You need to create an instance of a class that implements an abstract Alphabet class (e.g. the RusAlphabet class). Create an instance of the Cipher class, when creating, pass a reference to an instance of the Alphabet class.

File: main.cpp

#include <ctime>
#include <iostream>
#include <cstdlib>

#include "Cipher.h"
#include "RusAlphabet.h"


int main()
{
   system("chcp 1251");
   srand(time(nullptr));

   RusAlphabet alphabet;
   Cipher cipher(&alphabet);

   std::cout << "Input text: ";
   std::string text;
   std::getline(std::cin, text);

   GenerateKey::Key key = cipher.GetPublicKey();
   std::vector<uint64_t> encTxt = cipher.Encrypt(text, key);
   
   std::cout << "Encrypted text: ";
   for (uint64_t value : encTxt)
      std::cout << value;
   std::cout << std::endl;

   std::string srcText = cipher.Decrypt(encTxt);
   std::cout << "Decrypted text: " << srcText;
}

image

About

The algorithm allows you to encrypt and decrypt a message using RSA

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages