XOR Asoslari — Single Byte XOR Yechim
Masala tahlili
Har bayt 0x42 kalit bilan XOR qilingan.
Berilgan (hex): 1c 37 36 36 71 78 72 6e 70 72 37 6e 71 16 70 72
Fikrlash jarayoni
XOR xususiyati: (A XOR K) XOR K = A
Demak: ciphertext XOR 0x42 = plaintext
Bosqichma-bosqich yechim
1-qadam: Hex ni baytlarga aylantirish
hex_data = "1c 37 36 36 71 78 72 6e 70 72 37 6e 71 16 70 72"
data = bytes.fromhex(hex_data.replace(' ', ''))
2-qadam: 0x42 bilan XOR
key = 0x42
plaintext = bytes([b ^ key for b in data])
print(plaintext.decode())
3-qadam: Natija
NULL{xor_1s_basic}
Python script
#!/usr/bin/env python3
ct_hex = "1c 37 36 36 71 78 72 6e 70 72 37 6e 71 16 70 72"
ct = bytes.fromhex(ct_hex.replace(' ', ''))
key = 0x42
pt = bytes([b ^ key for b in ct])
print(f"Flag: {pt.decode()}")
Yakuniy flag
NULL{xor_1s_basic}
O'rganilganlar
- XOR operatsiyasining o'z-o'zini bekor qilish xususiyati
bytes.fromhex()ishlatish- List comprehension bilan baytlarni qayta ishlash