epithack-jpo/reverse/simple_xor.c

30 lines
619 B
C

#include <stdio.h>
#include <string.h>
unsigned char encrypted[] = {
0x07, 0x12, 0x0b, 0x16, 0x0a, 0x03, 0x01, 0x09, 0x39, 0x3a, 0x72,
0x30, 0x1d, 0x2b, 0x11, 0x1d, 0x24, 0x17, 0x2c, 0x3f
};
int main() {
unsigned char key;
unsigned char decrypted[21] = { 0 };
printf("Crypted text: \n");
for(int i = 0; i < 20; i++) {
printf("0x%02X", encrypted[i]);
}
puts("");
printf("XOR HEX KEY: ");
scanf("%hhx", &key);
for(int i = 0; i < 20; i++) {
decrypted[i] = encrypted[i] ^ key;
}
printf("Result: %s", decrypted);
return 0;
}