Results 1 to 9 of 9
  1. #1
    Defcon 1's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    10
    Reputation
    1
    Thanks
    2

    Simple Text Encryption

    Not sure why but I had a sudden urge to share this... It is my way of encrypting text thru vectors
    Code:
    /*
    *	Author: Defcon Noob :)
    *	July 20, 2011
    */
    
    #include <iostream>
    #include <Windows.h>
    #include <string>
    #include <time.h>
    #include <vector>
    #include <math.h>
    #include <stdio.h>
    
    
    using namespace std;
    int random;
    void encrypt( string &m, vector<int> &e); 
    void decrypt( string &m, vector<int> &e);
    
    int input;
    
    int main( )
    {
    	string m;
    	vector<int> e;
    	int choice;
    	int i=0;
    		cout << "Input string: " << endl;
    		getline(cin, m);
    		while(1){
    			cout << " " << endl;
    			cout << "Enter 0 for encrypt, 1 for decrypt." << endl;
    			cout << " " << endl;
    			Sleep(500);
    			cin >> choice;
    			if (choice)
    			{
    				input=45;
    				decrypt(m, e);
    			}
    			else
    			{
    				input=45;
    				encrypt(m, e);
    			}
    			Sleep(5000);
    		}
    	system("pause");
    	return 0;
    }
    void encrypt (string &m, vector<int> &e) 
    {
    	int size;
    	size = m.size();
    	for(int i=0; i < size; i++)
    	{
    		e.push_back((unsigned char)m[i] * input);
    		m[i] = ' ';
    	}
    	cout << " " << endl;
    	cout << "Encrypted string is: ";
    	cout << " " << endl;
    	for (int i = 0; i < e.size(); i++)
    		cout << e[i];
    	cout << endl;
    }
    void decrypt(string &m, vector<int> &e) 
    {
    	int size;
    	size = m.size();
    	for(int i=0; i < size; i++){
    		m[i] = (unsigned char)(e[i] / input );
    	}
    	cout << " " << endl;
    	cout << "Decrypted string is: " << m << endl;
    	cout << " " << endl;
    	
    }

  2. The Following User Says Thank You to Defcon 1 For This Useful Post:

    ___guilherme___ (11-09-2011)

  3. #2
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    Good job. If you really like encryption you should look up tutorials on Wincrypt.h

  4. The Following User Says Thank You to 258456 For This Useful Post:

    Defcon 1 (11-09-2011)

  5. #3
    radnomguywfq3's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Location
    J:\E\T\A\M\A\Y.exe
    Posts
    8,858
    Reputation
    381
    Thanks
    1,823
    My Mood
    Sad
    Speaking technically, this is encoding not encrypting; there is a fine difference between the two that are typically mixed.

    Encrypting will usually involve a key which is used while encrypting or decrypting data; this key defines the particular mathematical process used when recovering or obstructing the data. Where as encoding usually follows the same protocol when transforming all the data into another form (in this case, it just divides all the data by x, and recovers via multiplication.)

    A simple & commonly first introduced example of encryption is XOR encryption. Which invovles performing an XOR operation between the key and the data. Notice that in this form of encryption, the output of the data is dependant on the key (Which it is XORed with)



    There are two types of tragedies in life. One is not getting what you want, the other is getting it.

    If you wake up at a different time in a different place, could you wake up as a different person?


  6. The Following 2 Users Say Thank You to radnomguywfq3 For This Useful Post:

    Hassan (11-13-2011),Hell_Demon (11-09-2011)

  7. #4
    Defcon 1's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    10
    Reputation
    1
    Thanks
    2
    Quote Originally Posted by Jetamay View Post
    Speaking technically, this is encoding not encrypting; there is a fine difference between the two that are typically mixed.

    Encrypting will usually involve a key which is used while encrypting or decrypting data; this key defines the particular mathematical process used when recovering or obstructing the data. Where as encoding usually follows the same protocol when transforming all the data into another form (in this case, it just divides all the data by x, and recovers via multiplication.)

    A simple & commonly first introduced example of encryption is XOR encryption. Which invovles performing an XOR operation between the key and the data. Notice that in this form of encryption, the output of the data is dependant on the key (Which it is XORed with)
    Oh ok .

  8. #5
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh
    Quote Originally Posted by Jetamay View Post
    Speaking technically, this is encoding not encrypting; there is a fine difference between the two that are typically mixed.

    Encrypting will usually involve a key which is used while encrypting or decrypting data; this key defines the particular mathematical process used when recovering or obstructing the data. Where as encoding usually follows the same protocol when transforming all the data into another form (in this case, it just divides all the data by x, and recovers via multiplication.)

    A simple & commonly first introduced example of encryption is XOR encryption. Which invovles performing an XOR operation between the key and the data. Notice that in this form of encryption, the output of the data is dependant on the key (Which it is XORed with)
    I Love You!

  9. #6
    Saltine's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Posts
    493
    Reputation
    104
    Thanks
    629

    Leeched.

  10. The Following 2 Users Say Thank You to Saltine For This Useful Post:

    Hassan (11-13-2011),Hell_Demon (11-12-2011)

  11. #7
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Leeched.
    /Closed.

  12. #8
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Apparently this is not leeched as the proof has been provided:





    Re-opened.

  13. #9
    Defcon 1's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    10
    Reputation
    1
    Thanks
    2
    Lol it's all good welp my new account/start over has been blown out of the water GG

Similar Threads

  1. [Release] Flameswor10's Simple/Step Encryption Methods
    By flameswor10 in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 22
    Last Post: 06-02-2012, 09:21 AM
  2. [Release] My simple Text Based RPG!
    By VvITylerIvV in forum C++/C Programming
    Replies: 6
    Last Post: 06-02-2011, 06:51 PM
  3. [Solved] New modder Need help with simple text input NOOB!!
    By rotceh_dnih in forum Call of Duty Black Ops GSC Modding Help & Discussion
    Replies: 3
    Last Post: 02-28-2011, 04:26 AM
  4. How to make a simple text based game in c++
    By VvITylerIvV in forum Programming Tutorials
    Replies: 13
    Last Post: 08-09-2010, 05:49 PM
  5. [VB][Release] Text Encrypter
    By CoderNever in forum Visual Basic Programming
    Replies: 2
    Last Post: 09-27-2009, 11:03 PM