I'm trying to encrypt this char array using pointer subscript notation and I need help with the algorithm. I don't understand how the ENCRYPTION_KEY affects the encryption and how to utilize it.
Code:
#include<iostream>
#include<conio.h>
#include<string>
#include<cstring>
using namespace std;
//encrypt(char *ptr);
const int ENCRYPTION_KEY = 1;
void main()
{
char temp1[26];
char temp2[26];
char password[11];
char *ptr;
cout<<"Please enter a password no more than 25 characters in length: ";
cin>>temp1;
cout<<temp1;
cout<<"Re-enter your password: "<<endl;
cin>>temp2;
cout<<temp2<<endl;
cout<<strcmp(temp1, temp2)<<endl;
while (strcmp(temp1, temp2) !=0){
cout<<"Invalid Password"<<endl;
cout<<"Re-enter your password: "<<endl;
cin>>temp2;
}
strncpy (password, temp1, 11);
password[10]='\0';
cout<<password<<endl;
ptr=password;
//encrypt(ptr);
getch();
}
//void encrypt(char *ptr)
//{
//for (i =0; i<11; i++)
//ptr[i]
//}
[code][/code]tagged by Salem