Click here to Skip to main content
16,007,885 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Getting user input into a list control Pin
Rajesh R Subramanian25-Jun-08 2:42
professionalRajesh R Subramanian25-Jun-08 2:42 
QuestionRe: Getting user input into a list control Pin
theCPkid25-Jun-08 3:32
theCPkid25-Jun-08 3:32 
AnswerRe: Getting user input into a list control Pin
Rajesh R Subramanian25-Jun-08 3:52
professionalRajesh R Subramanian25-Jun-08 3:52 
AnswerRe: Getting user input into a list control Pin
Steen Krogsgaard25-Jun-08 3:13
Steen Krogsgaard25-Jun-08 3:13 
QuestionHow to hide pw in C++ command line exe Pin
Nandu_77b25-Jun-08 1:59
Nandu_77b25-Jun-08 1:59 
AnswerRe: How to hide pw in C++ command line exe Pin
theCPkid25-Jun-08 2:11
theCPkid25-Jun-08 2:11 
QuestionRe: How to hide pw in C++ command line exe Pin
Rajesh R Subramanian25-Jun-08 2:51
professionalRajesh R Subramanian25-Jun-08 2:51 
AnswerRe: How to hide pw in C++ command line exe - source code Pin
Nandu_77b25-Jun-08 3:07
Nandu_77b25-Jun-08 3:07 
Below is the code


#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
using namespace std;




string XOR(string value,string key)
{
string retval(value);

short unsigned int klen=key.length();
short unsigned int vlen=value.length();
short unsigned int k=0;
short unsigned int v=0;

for(v;v<vlen;v++)
{
retval[v]=value[v]^key[k];
k=(++k<klen?kBlush | :O );
}

return retval;
}

/******************************************************************************/
/* Here's a Test Program */
/******************************************************************************/



int main()
{
//string value("just for fun");
string key = "TERADATA";
string username;
string password;
string cnfpassword;
ofstream myfile;

cout<<"Enter user name::";
cin>>username;

cout<<"Enter Password\n";
cout<<"NOTE:\n"<<"1) Password can be alphanumeric or numeric or alphabets\n"
<<"2) Blank spaces not allowed\n"<<"::";
cin>>password;

cout<<"Confirm Password::";
cin>>cnfpassword;

if (password.compare(cnfpassword) != 0)
{
cout<<"Sorry Password dose not match....try again"<<"\n";
return 1;
}
else
{
password=XOR(password,key);
}

cout<<"Encrypted Password ::"<<"\n";
cout<<password<<"\n\n";

myfile.open("Test_SSOpw.txt", ios::out);

if( !myfile )
cout<<"Error opening file";
else
{
myfile.write("#USERNAME#", 10);
myfile.write(username.c_str(), username.length());
myfile <<'\n';
myfile <<"#PASSWORD#"<<password;
myfile.close();
cout<<"Functional SSO password encryption success!!"<<'\n';
}

password=XOR(password,"TERADATA");
cout<<"Decrypted Password ::"<<password<<"\n";

getch();
return 0;
}
QuestionRe: How to hide pw in C++ command line exe - source code Pin
Nandu_77b25-Jun-08 3:31
Nandu_77b25-Jun-08 3:31 
AnswerRe: How to hide pw in C++ command line exe - source code Pin
Rajesh R Subramanian25-Jun-08 3:43
professionalRajesh R Subramanian25-Jun-08 3:43 
QuestionRe: How to hide pw in C++ command line exe - source code Pin
Nandu_77b25-Jun-08 3:47
Nandu_77b25-Jun-08 3:47 
AnswerRe: How to hide pw in C++ command line exe - source code Pin
Rajesh R Subramanian25-Jun-08 4:13
professionalRajesh R Subramanian25-Jun-08 4:13 
GeneralRe: How to hide pw in C++ command line exe - source code Pin
Nandu_77b25-Jun-08 5:06
Nandu_77b25-Jun-08 5:06 
QuestionProblem writing in to a File Pin
sunny_vc25-Jun-08 1:53
sunny_vc25-Jun-08 1:53 
AnswerRe: Problem writing in to a File Pin
toxcct25-Jun-08 2:17
toxcct25-Jun-08 2:17 
GeneralRe: Problem writing in to a File Pin
sunny_vc25-Jun-08 2:23
sunny_vc25-Jun-08 2:23 
GeneralRe: Problem writing in to a File Pin
toxcct25-Jun-08 2:24
toxcct25-Jun-08 2:24 
GeneralRe: Problem writing in to a File Pin
Rajesh R Subramanian25-Jun-08 2:26
professionalRajesh R Subramanian25-Jun-08 2:26 
GeneralRe: Problem writing in to a File Pin
sunny_vc25-Jun-08 2:34
sunny_vc25-Jun-08 2:34 
GeneralRe: Problem writing in to a File Pin
toxcct25-Jun-08 3:04
toxcct25-Jun-08 3:04 
QuestionRe: Problem writing in to a File Pin
_AnsHUMAN_ 25-Jun-08 2:23
_AnsHUMAN_ 25-Jun-08 2:23 
AnswerRe: Problem writing in to a File Pin
sunny_vc25-Jun-08 2:29
sunny_vc25-Jun-08 2:29 
GeneralRe: Problem writing in to a File Pin
Rajesh R Subramanian25-Jun-08 2:41
professionalRajesh R Subramanian25-Jun-08 2:41 
GeneralRe: Problem writing in to a File Pin
sunny_vc25-Jun-08 2:43
sunny_vc25-Jun-08 2:43 
AnswerRe: Problem writing in to a File Pin
Bram van Kampen25-Jun-08 11:11
Bram van Kampen25-Jun-08 11:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.