___guilherme___ (11-09-2011)
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; }
___guilherme___ (11-09-2011)
Good job. If you really like encryption you should look up tutorials on Wincrypt.h
Defcon 1 (11-09-2011)
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?
Hassan (11-13-2011),Hell_Demon (11-09-2011)
Hassan (11-13-2011),Hell_Demon (11-12-2011)
Leeched.
/Closed.
Apparently this is not leeched as the proof has been provided:
Re-opened.
Lol it's all good welp my new account/start over has been blown out of the water GG