can some one give me the code to make a small program that could passcode my programms and allplication so only i could use it
for c++,, (dev c++)
^.^
Printable View
can some one give me the code to make a small program that could passcode my programms and allplication so only i could use it
for c++,, (dev c++)
^.^
just put a password/login on all your programs?
if you want a quick, insecure way, try something like this:Code:#include<iostream>
#include<fstream>
using std::cin;
using std::cout;
using std::ifstream;
int main()
{
char*pword=new char[10];
char*fpword=new char[10];
ifstream infile("C:\\somewhere\\somewhere\\something.dat");
ifstream>>fpword;
infile.close();
cout<<"Enter Password: ";
cin>>pword;
if(strcmpi(pword,fpword))
{
/* PUT PROGRAM HERE */
}
else
{
cout<<"Stop trying to crack my software!";
return 0;
}
delete[]fpword;
delete[]pword;
}
what i did not understand very wellQuote:
Originally posted by major_small
just put a password/login on all your programs?
^.^
1. Define a string with the known correct password.
2. Display a message asking the user to enter the password.
3. Get the user's string.
4. Compare the strings.
5. If the strings match, continue (or return "true", etc). If the strings don't match, return 0.
If you want to get fancy, you can add an option to change the password and save it to a file... maybe encrypted.
i was posting code while you were posting a reply...Quote:
Originally posted by nerdyneo
what i did not understand very well
^.^
my code got a little fancy and reads it from a file, so you can have all your programs read the same file and use the same password and you can change it for all programs easily...Quote:
Originally posted by DougDbug
If you want to get fancy, you can add an option to change the password and save it to a file... maybe encrypted.
for encryption, I suggest something like this:and for a decryption algorithm jsut put a minus in front of the 5 (or whatever number you want to use)Code:...
for(int i=0;i<strlen(fpword);i++)
fpword[i]=static_cast<char>(static_cast<int>(fpword[i])+5);
...
once again, this isn't very secure at all, but it doesn't seem like you're trying to block your apps from the CIA, either...