You saying I wrote up the other thing for nothing?
But nothing beats figuring out a programming problem yourself !
Haha! eat it Dev-C++..
My Encryption program is now fully(73%) working!
Intructions:
Encrypt
1. Download all files into the same folder
2. Type the message you want to encrypt into encrypt.txt
3. The the encrypted text will be saved to decrypt.txt
4. Run Encrypt.exe
5. Type in a one character key (This key will be used to decrypt your message.)
6. Just open up decrypt.txt to view the encryption.
Decrypt
1. Copy and paste the code you want to decrypt into the encrypt.txt & save
2. Clear the decrypt.txt and save it. (you will need it clear to view the decrypted message)
3. Run Encrypt.exe
4. Type in the key used to decrypt the file.
5. Check decrypt.txt for the decrypted message.
Credits:
A freakin huge amount of credit goes to zeco for figuring out how to write and read files. Thanks zeco
Wo_Ot! lalakijilp got the secret message. Here is the source:
I have also included the source in an attached .txt fileCode:#include <iostream> #include <fstream> #include <string> using namespace std; void encrypt(); void decrypt(); void start(); int main() { start(); system("pause"); return 0; } void start(){ char choice; cout << "Would you like to encrypt, or Decrypt a file?\n" << endl; cout << "q.) Quit\n"; cout << "e.) Encrypt/Decrypt\n"; cin >> choice; switch(choice){ case 'q': break; case 'e': system("cls"); decrypt(); system("cls"); start(); break; default: system("cls"); start(); break; } } void decrypt() { fstream ifile; fstream efile; char key; string iput; ifile.open("encrypt.txt"); efile.open("decrypt.txt"); cout << "Place the text you want to decrypt or encrypt in the file 'encrypt.txt'"<<endl; if (ifile.is_open()) { cout << "What key is the input encrypted in?" << endl; cin >> key; while(!ifile.eof()) { getline(ifile, iput); for(int i = 0; iput[i]; i++) { iput[i] = iput[i] ^ key; } efile << iput; cout << iput; } ifile.close(); efile.close(); } cout << endl; system("pause"); }
There is a sample message to decrypt included in the encrypt.txt file. the key is 'd'. Have fun!
Last edited by why06; 09-06-2009 at 08:11 AM.
"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
You saying I wrote up the other thing for nothing?
But nothing beats figuring out a programming problem yourself !
"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
lol no worries.. that's the reason to post code here so people can copy & read & learn & improve etc..
I think I will work on a second version in a couple weeks because I want to learn more stuff before I just jump into making a second one.
BTW: I hope someone at least tries to decrypt my message. I know it's really hard to use, I need to make a GUI for it, but idk how to do that yet either...
"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
The ugly Ducklig ate a shoe
maybe it is an idea to make it possible to change the programm that you can enter the txt files name so you dont have to change it al the time.
Haha! Wo_Ot! you got the secret message! I will post the source code now.
Unfortunately... there are still some bugs when decrypting. Some letters end up capitalized and It all prints on one line.
Thanks for texting it lalakijilp, really appreciate that. I want to make a GUI for it because I know it is a little difficult to use now :L
"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
GUI = graphical user interface, but close ;P'
That's an interesting idea, but this encryption is very weak.
"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
deleted double post
Last edited by why06; 09-06-2009 at 09:17 PM.
Yeah, while i was away i realized it would be awesomely easy to use with a gui. I have a basic understanding of what we could do, but little idea of how we could implement it >_<.
I'll tinker a bit, until i fail.
Hey zeco! your back from ur trip. While u were gone I've been tinkering a lot. And finally got it to work mainly messing around with your source. It would be really cool to add a GUI to it. I mean I doubt that we'll use it, but I guess we could use it encrypt websites or something since the filter usually blocks them, but I would have to change the encryption because this vBulletin board doesn't support the full ASCI character set. :L
"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
I have also been thinking about a gui, i think they key thing to think about when creating a gui, is how to get information from textboxes. They are probably an object so when i get a chance i will see if there is a way to read text from them. If there is i will try some stuff xD. But really i have little idea about gui programming. It Shall be interesting.
lol you guys... that's the easy part!
Figure out how you want to make it:
a) Win32 (writing the WndProc etc) and define the UI in code
b) Win32 and use the resource editor in VS to build the UI
c) Use something that makes it easier like MFC
d) or just make something in C# (you can link to C++ dlls if you want)
easiest way to get a GUI working would be to use MSVC++ 2003 .net since that has a working visual resource editor and can basicly give you the full code for creating a window and add buttons and stuff to it.