#include <iostream>
#include<string>
using namespace std;
int main()
{
string admin_pwd="testing";
string encrypted ;
string unencrypted;
char key[5] = "abcd";
for (int x=0; x < admin_pwd.size(); x++){
encrypted += admin_pwd[x] ^ key[x/100%30];
}
cout << "Encrypted = " << encrypted<<endl;
for (int x = 0; x < admin_pwd.size(); x++){
unencrypted += encrypted[x] ^ key[x/100%30];
}
cout << "Unencrypted = " << unencrypted<<endl;
system("pause");
}
I want my source code not to contain the text password on itself. so how do i implement above thing for a password input check(authentication) or a login system like below one?
I mean how to combine them to get a secure login
int main()
{
string pswd ="";
char inpt;
cout << "Enter password\n";
inpt = _getch();
while(inpt != 13)
{
pswd.push_back(inpt);
cout << '*';
inpt = _getch();
}
if(pswd == "testing")
cout << "\nAccess granted :P\n";
else
cout << "\nAccess aborted...\n";
system("pause");
return 0;
}