Challenge 'Didactic XOR Cipher'
2018. 2. 15. 02:14ㆍ0x05 Crypto/hacker.org
728x90
문제: hex 값으로 인코딩 된 3d2e212b20226f3c2a2a2b을 이용하라.
각각의 문자들은 XOR 79(DEC)가 되어 있다.
답 : XOR의 원리를 알아야 한다.
A ^ ? = B
B ^ ? = A
79(dec) -> 4F
#include <stdio.h>
int main(){
int a[] = { 0x3d,0x2e,0x21,0x2b,0x20,0x22,0x6f,0x3c,0x2a,0x2a,0x2b };
int xor_val = 0x4f;
for (int i = 0; i < sizeof(a)/sizeof(a[0]); i++)
{
a[i] = a[i] ^= xor_val;
}
for (int i = 0; i < sizeof(a) / sizeof(a[0]); i++)
{
putchar(a[i]);
}
return 0;
}
random seed
'0x05 Crypto > hacker.org' 카테고리의 다른 글
Challenge 'Didactic Bits' (0) | 2018.02.15 |
---|---|
Challenge 'Didactic RGB' (0) | 2018.02.15 |
Challenge 'Didactic XOR' (0) | 2018.02.15 |
Challenge 'Didactic Text' (0) | 2018.02.15 |
Challenge 'Didactic Bytes' (0) | 2018.02.15 |