diff --git a/C/main.c b/C/main.c new file mode 100644 index 0000000..9816c30 --- /dev/null +++ b/C/main.c @@ -0,0 +1,23 @@ +#include +#include + +void encryptDecrypt(char *input, char *output) { + char key[] = {'K', 'C', 'Q'}; //Can be any chars, and any size array + + int i; + for(i = 0; i < strlen(input); i++) { + output[i] = input[i] ^ key[i % (sizeof(key)/sizeof(char))]; + } +} + +int main (int argc, char *argv[]) { + char baseStr[] = "kylewbanks.com"; + + char encrypted[strlen(baseStr)]; + encryptDecrypt(baseStr, encrypted); + printf("Encrypted:%s\n", encrypted); + + char decrypted[strlen(baseStr)]; + encryptDecrypt(encrypted, decrypted); + printf("Decrypted:%s\n", decrypted); +} \ No newline at end of file