Created
July 19, 2017 20:36
-
-
Save pandasauce/6d888320077e6b7cd69d64c0efafcc64 to your computer and use it in GitHub Desktop.
Xorist 101
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <memory.h> | |
#include <stdlib.h> | |
#define LENGTH 20 | |
int main() | |
{ | |
char const plainone[LENGTH] = "BASIC XOR CRYPTO"; | |
char const plaintwo[LENGTH] = "WINKWINKWINKWINK"; | |
char xor[LENGTH]; | |
int i; | |
for(i = 0; i < LENGTH; ++i) { | |
xor[i] = (char)(plainone[i] ^ plaintwo[i]); | |
} | |
printf("Input: %s\nKey: %s\n\nXOR: ", plainone, plaintwo); | |
for(i = 0; i < LENGTH; ++i) { | |
printf("%02X ", xor[i]); | |
} | |
printf("\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment