Getting back into Encryption

Posts 1–7 of 7 · Page 1 of 1
Getting back into Encryption
Yeh well I am getting back into encryption again. The first time I was just testing the waters, but this time I think I'm going to really make some head way. My first goal is to master XOR encryption.

I have created a sample program here which encrypts a message with a variable lengthed key. So now my simple brute force 1 key method won't work to crack it:

Code:
#include <iostream>
#include <fstream>
using namespace std;
void XOREncrypt(unsigned char* key, char* plaintext);

int main()
{
    char plaintext[50];
    unsigned char key[50];
    
    for(;;)
    {
     cout<<"Plaintext file name: ";
     cin >> plaintext;
     cout<<"Encryption Key: ";
     cin >> key;
     XOREncrypt(key, plaintext);
    }
    return 1;
}

void XOREncrypt(unsigned char* key, char* plaintext)
{
                 fstream plainfile(plaintext, ios::in | ios::out | ios::binary);
                 fstream cipherfile("ciphertext.txt", ios::in | ios::out | ios::binary | ios::trunc);
                 int i = 0;
                 char ch;
                 while(plainfile)
                 {
                  plainfile.get(ch);
                  if(plainfile)
                  {
                        cipherfile.put(ch ^ key[i]);
                        i++;
                        if(!key[i]) i = 0;
                  }
                 }
                 cout<< "XOR Encryption finished. Check ciphertext.txt" << endl;
                 return;
}
This code I am going to write over the next few weeks is meant to be cleaner and more concise then anything I've done before. I will be experimenting with incorporating unicode, and conversions between unicode and ASCI. Create techniques for cracking files, determining key length, using dictionaries, and a lot more. Like I said I hope to get atleast a decent understanding of some very rudimentary techniques.
I might get back into brute forcing if you keep up with encryption. I'm too wrapped up in packet sniffing and manipulation atm though.
Quote Originally Posted by rwkeith View Post
I might get back into brute forcing if you keep up with encryption. I'm too wrapped up in packet sniffing and manipulation atm though.
Packet manipulation? Actually I started trying to get into stuff like that recently (weekend). Would you be able to PM me tips and info about it? The furthest I've gone thus far is starting to learn about windows sockets.
Quote Originally Posted by rwkeith View Post
I might get back into brute forcing if you keep up with encryption. I'm too wrapped up in packet sniffing and manipulation atm though.
my cousin used to get free stuff from sites when first brute forcing got discovered. i wish it had worked in this days too.
Code:
#include <iostream>
#include <fstream>
using namespace std;
void XOREncrypt(unsigned char* key, char* plaintext);

int main()
{
    char plaintext[50];
    unsigned char key[50];
    
   while(1)
    {
     cout<<"Plaintext file name: ";
     cin >> plaintext;
     cout<<"Encryption Key: ";
     cin >> key;
     XOREncrypt(key, plaintext); 
     cout<< "XOR Encryption finished. Check ciphertext.txt" << endl;
    system("ciphertext.txt");
    }
    return 1;
}

void XOREncrypt(unsigned char* key, char* plaintext)
{

freopen(plaintext,"r",stdin);
freopen("ciphertext.txt,"w",stdout);

int i;

char plainstr[256];
cin>>plainstr;
for(i=0;i<strlen(plainstr);i++)cout<<plainstr[i]^key[i];
                
                 return;
}
I don't understand what you just did there? =/
He did nothing. I'm going to start learning about SQL and databases and stuff. I don't know why, but I like working with databases. post your advances in encryption here so I may use them pl@wkz.
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us