Results 1 to 7 of 7
  1. #1
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty

    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.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  2. #2
    rwkeith's Avatar
    Join Date
    Jul 2008
    Gender
    male
    Posts
    457
    Reputation
    11
    Thanks
    79
    My Mood
    Angelic
    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.
    Goals In Life:
    [X] Become an Advanced Member
    [X]Release a tut on mpgh
    [0]Post 300 posts
    [X]Make a working hack
    [X] Learn c++

  3. #3
    zeco's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    Canada
    Posts
    683
    Reputation
    12
    Thanks
    78
    My Mood
    Cynical
    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.

  4. #4
    zhaoyun333's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    396
    Reputation
    11
    Thanks
    1,125
    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;
    }
    There are five possible operations for any army. If you can fight, fight; if you cannot fight, defend; if you cannot defend, flee; if you cannot flee, surrender; if you cannot surrender, die." - Sima Yi

  5. #5
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    I don't understand what you just did there? =/

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  6. #6
    t7ancients's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    New York
    Posts
    381
    Reputation
    28
    Thanks
    68
    My Mood
    Twisted
    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.

  7. #7
    Matrix_NEO006's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Posts
    240
    Reputation
    12
    Thanks
    33
    My Mood
    Lonely
    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.

Similar Threads

  1. Getting back into the game
    By Wild Bill HickCock in forum Galleries
    Replies: 1
    Last Post: 04-29-2011, 01:57 AM
  2. getting back into trollin sites
    By WoopwoopaJiggaboo in forum General
    Replies: 7
    Last Post: 11-12-2010, 03:17 PM
  3. Trying to get back into hacking...
    By Nitrocola in forum MapleStory Help
    Replies: 8
    Last Post: 10-04-2010, 11:12 PM
  4. [Help] Can't get back into combat arms
    By XxRaYdEnxX in forum Combat Arms Hacks & Cheats
    Replies: 8
    Last Post: 07-20-2009, 10:02 PM
  5. Getting back into GFX?
    By Mikoll in forum Art & Graphic Design
    Replies: 4
    Last Post: 04-12-2008, 06:44 PM