//XOR Encrypt 0.0.1 //by Sean Kane - http://celtickane.com #include #include #include char *crypt(char *bufData, char *bufKey, int strLength); int main() { char bufData[50], bufKey[50]; char *ptrData, *ptrKey; char chrChoice; ptrData = bufData; ptrKey = bufKey; while ((chrChoice!='q') && (chrChoice!='Q')) { printf("Encrypt(E), Decrypt(D), Quit(Q): "); scanf("\n%c",&chrChoice); switch (chrChoice) { case 'e': case 'E': printf("Enter word to encrypt: "); chrChoice = scanf("%s",ptrData); printf("Enter encryption key: "); scanf("%s",ptrKey); ptrData = crypt(ptrData,ptrKey, strlen(bufKey)); printf("Encrypted data: %s\n\n",bufData); break; case 'd': case 'D': printf("Enter word to decrypt: "); scanf("%s",ptrData); printf("Enter encryption key: "); scanf("%s",ptrKey); ptrData = crypt(ptrData,ptrKey, strlen(bufKey)); printf("Decrypted data: %s\n\n",bufData); break; case 'q': case'Q': break; default: printf("\nPlease type E, D, or Q\n"); break; } } return 0; } char *crypt(char *bufData, char *bufKey, int strLength) { int d, k; k = 0; for(d=0;d