← Writeuplarga qaytish

Single Byte XOR — NULL{ prefix yordamida kalit topish

XOR O'rta Masala: Bitta Baytli XOR NullCTF Team · 16.05.2026

Masala tahlili


Noma'lum bitta baytli kalit. Flag NULL{ bilan boshlanadi.


Berilgan hex: 2b 0e 0b 0b 5c 79 76 6d 6f 76 5c 78 7c 79 55 7c 76


Fikrlash jarayoni


Flag NULL{ bilan boshlanadi:

  • N = 78 (0x4E)
  • Birinchi shifrlangan bayt: 0x2B

Demak: kalit = 0x2B XOR 0x4E = 0x65 = 'e'


Bosqichma-bosqich yechim


1-qadam: Known-plaintext


ct = bytes.fromhex("2b0e0b0b5c7976...")
# Flag N=0x4E bilan boshlanadi
key = ct[0] ^ 0x4E  # 0x2B XOR 0x4E = 0x65
print(f"Kalit: {key} = 0x{key:02x} = '{chr(key)}'")

2-qadam: Deshifrlash


pt = bytes([b ^ key for b in ct])
print(pt.decode())

Python script


#!/usr/bin/env python3

ct_hex = "2b0e0b0b5c7976..."
ct = bytes.fromhex(ct_hex.replace(' ', ''))

# Known-plaintext: birinchi harf 'N' (0x4E)
key = ct[0] ^ ord('N')
print(f"Kalit topildi: {key} (0x{key:02x}) = '{chr(key)}'")

# Deshifrlash
pt = bytes([b ^ key for b in ct])
print(f"Flag: {pt.decode()}")

Yakuniy flag


NULL{single_byte_xor}

O'rganilganlar


  • Known-plaintext hujumi
  • XOR ning inversli xususiyati
  • Flag formati yordamida kalit topish