Breaking Sec

Full Version: Message encryptor/decryptor [C++]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
These are programs that will encrypt and then decrypt messages. The encryptor stores it in Restricted.txt and then the decryptor reads from Restricted.txt and puts the original message in Cleared.txt. Enjoy.

Encryptor:
Code:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

char getnc(char buff)
{
    int a;
    a = buff;
    a = a + 5;
    buff = a;
    return buff;
}
int main()
{
    int len;
    string str;
    getline (cin, str);
    len = str.size();
    int val[len];
    int count;    
    for(count = 0; count < len; count++)
    {
        str[count] = getnc(str[count]);
    }
    ofstream myfile;
    myfile.open ("Restricted.txt");
    myfile << str;
    myfile.close();
    return 0;
}

Decryptor:
Code:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
char getnc(char mug)
{
     int a;
     a = mug;
     a = a - 5;
     mug = a;
     return (mug);
}
int main()
{
    int len;
    string str;
    ifstream file;
    file.open ("Restricted.txt");
    file >> str;
    len = str.size();
    int val[len];
    int count;
    for(count = 0; count < len; count++)
    {
              str[count] = getnc(str[count]);
    }
    ofstream myfile;
    myfile.open ("Cleared.txt");
    myfile << str;
    myfile.close();
    return 0;
}
make this yourself or copypasta?
I dont post copypasta
Or does he? *dramatic music starts to play in the background a spooky fog covers teh interwebz*
No, I don't. >:[
Reference URL's