WARGAME/cryptography

[CryptoHack] XOR Starter

lucykorea414 2024. 1. 2. 19:33
728x90

XOR 표현식 = ^

 

 

 

 

2진수 예시)

0110 ^ 1010 = 1100

 

 

10진수를 XOR 하기 위해서는 2진수로 바꿔야한다.

문자를 XOR 하기 위해서는 각 문자를 유니코드로 바꾸고 다시 2진수로 바꿔서 계산해야함.

 

 

quiz)

Given the string label, XOR each character with the integer 13. 
Convert these integers back to a string and submit the flag as crypto{new_string}.

 

 

풀이)

pwntools 라이브러리의 xor() 사용해서 쉽게 풀 수 잇음.

 

1. pwntools xor() 사용 하는 방법

2. 직접 xor 하는 경우

 

b prefix를 추가하지 않으면 int와 str의 계산이 안됨!

728x90

'WARGAME > cryptography' 카테고리의 다른 글

[CryptoHack] Favourite byte  (0) 2024.01.02
[CryptoHack] XOR Properties  (2) 2024.01.02
[CryptoHack] Bytes and Big Integers  (1) 2024.01.02
[dreamhack] SingleByteXor  (1) 2023.11.08
[dreamhack] ICM2022  (0) 2023.11.08