Opinion..
|
|||
|
Rank: ? (8)
Member #: 27517 |
I tried to create my own encryption program using the XOR operator. I need your opinion on this...how I can improve it, why it will never work, etc etc...thanks.
//Encryption Process else if (!strcmp(argv[1], "encrypt" char input[21]; cout << "Enter word: "; cin >> input; char key1 = 'a'; //key to be XOR char key2 = 'b'; //another key to be XOR int x = strlen(input); //get length of string and assign to x char word[x]; //a character array with the same length as the string strcpy(word, input); //put the input to the character word array cout << "Encrypted word: "; //loop through the elements of "word" while XOR each element to key1 then to key2 for(int i = 0; i < x; i++) { word [i] = word[i] ^ key1 ^ key2; cout << word[i]; } cout << endl; }
MAGIS
|
||
|
|||
|
|||
|
Rank: ? (119)
Member #: 28292 |
The problem could appear when after xoring the symbol could become a control character with value x for 0 <= x <= 32. These could be read false or it could become the symbol of EOF (End of file) which will stop reading.
|
||
|
Please login or register to post a reply.