You're on the right track with Hamming codes and telemetry — this is a classic CTF challenge involving error-correcting codes used in radio telemetry systems, especially in space missions, amateur radio, or satellite downlinks. Let's break down your clues and guide you toward decoding the data.
🔍 Key Observations & Clues
-
"Hamming" + "Telemetry"
→ Strong hint: Hamming codes are widely used in telemetry systems (e.g., NASA, amateur radio satellites like FUNcube, AO-73, BRICSat, etc.) for forward error correction (FEC).
-
Preamble: 101010101010101011 (18 bits)
→ This is a standard Barker-like preamble used for frame synchronization. The last two bits (11) break the alternating pattern — common in CCSDS (Consultative Committee for Space Data Systems) or AX.25-like systems.
-
16 frames × 912 bits → 894 bits payload per frame after removing 18-bit preamble
→ 894 = 2 × 3 × 149
→ 894 is not divisible by 8, so not byte-aligned → likely bit-packed, or encoded with a code rate (e.g., 1/2, 2/3, etc.)
-
Frames differ after preamble, and final bits differ
→ Suggests variable data (e.g., telemetry counters, timestamps, sensor readings) and possibly CRC or checksum at the end.
-
"Raw radio signal" → you've binarized it
→ You now have a bitstream, likely post-demodulation, possibly NRZ or Manchester-encoded (but since you have clean 0s and 1s, assume NRZ).
🧠 Step-by-Step Decoding Strategy
✅ Step 1: Check for Bit Inversion / Polarity
Sometimes the signal is inverted (0s and 1s swapped). Try:
- Invert all bits and see if the data becomes more regular.
- Look for long runs of 1s or 0s — if present, it may be a DC bias or bit stuffing artifact.
🔎 Tip: Try both polarities. A good sign: if one version has longer runs of 0s/1s or more structure, use that.
✅ Step 2: Look for Known Telemetry Protocols
Common telemetry FEC schemes using Hamming codes:
| Protocol | FEC | Notes |
|---|
| AX.25 | None (or optional) | But often used with HDLC, bit stuffing, CRC-16 |
| CCSDS (Space Data Link) | Reed-Solomon + Convolutional, but also uses (7,4) or (15,11) Hamming in some modes | |
| FUNcube / AO-73 | (7,4) Hamming + 255-bit Golay + Reed-Solomon | Very common in CTFs |
| SSTV / AFSK | Often (7,4) Hamming on data bytes | |
| Custom Hamming-only systems | Especially if data is small and real-time | |
🚩 Most likely: (7,4) Hamming code or (15,11) Hamming, possibly concatenated or interleaved.
✅ Step 3: Check for (7,4) Hamming Code (Most Probable)
- (7,4) Hamming encodes 4 data bits into 7 bits.
- So code rate = 4/7 ≈ 0.57
- Try: 894 bits / 7 ≈ 127.7 → not integer
- But: 894 / 7 = 127.714... → ❌ not divisible
Try (15,11) Hamming:
- Code rate = 11/15 ≈ 0.733
- 894 / 15 = 59.6 → not integer
Try (31,26): 894 / 31 ≈ 28.8 → no
Wait — maybe not full-frame encoding? Or multiple layers?
🔎 New idea: What if only part of the frame is encoded, and the rest is raw?
But look again: 894 = 2 × 3 × 149
Wait — 149 is prime. Hmm.
But: 894 ÷ 6 = 149 → so 149 groups of 6 bits?
Or: 894 ÷ 12 = 74.5, not good.
Wait — 894 ÷ 8 = 111.75 → not byte-aligned.
But 894 ÷ 16 = 55.875 → no.
But: What if the data is (7,4) Hamming encoded, and we need to decode in chunks?
Try: How many (7,4) codewords fit?
- 7 × 127 = 889 → remainder 5 → not good
- 7 × 128 = 896 → too big
But: What if the frame is padded to 896 bits? → 896 ÷ 7 = 128 codewords → 128 × 4 = 512 bits decoded
→ 512 bits = 64 bytes → very clean!
✅ Hypothesis:
The 894-bit payload is padded with 2 bits (to 896), then encoded with (7,4) Hamming, giving 128 codewords → 512 data bits = 64 bytes.
Or: Maybe it's (7,4) Hamming on 512 data bits → 896 bits, and 2 bits are dropped or used for sync?
But you have 894 bits, not 896.
Wait — what if the last 2 bits are CRC or frame counter? Or the encoder used 127 codewords (889 bits), and 5 bits are extra?
Alternatively — maybe it's (15,11) Hamming with padding?
- 15 × 59 = 885 → remainder 9 → not good
- 15 × 60 = 900 → too big
But 894 = 900 - 6 → possible?
Wait — another idea: What if the data is (3,2) or (6,5) Hamming-like, or even a different code?
But "Hamming" in CTFs usually means (7,4).
🔥 Most plausible: **(7,4) Hamming with padding to 896 bits (128 codewords), and you're missing 2 bits due to binarization error, or they are at the end (CRC, sync, or padding).
👉 Try this:
- Take each 894-bit frame.
- Pad with 0s or 1s to make 896 bits (add 2 bits at end).
- Split into 128 groups of 7 bits.
- Apply (7,4) Hamming decoder to extract 512 bits (64 bytes) per frame.
- Look for structure in the 64-byte output.
🛠️ Hamming (7,4) decoder:
- Each 7-bit block:
p1 p2 d1 p3 d2 d3 d4
- Parity bits at positions 1, 2, 4.
- Use standard Hamming correction: compute syndrome, flip bit if error, extract d1–d4.
📦 Tools:
- Python
bitstring or numpy + custom decoder.
- Or use
pyhamming (pip install pyhamming) — but verify it's (7,4).
def hamming_decode_74(codeword):
# codeword: 7-bit list
p1 = codeword[0] ^ codeword[2] ^ codeword[4] ^ codeword[6]
p2 = codeword[1] ^ codeword[2] ^ codeword[5] ^ codeword[6]
p3 = codeword[3] ^ codeword[4] ^ codeword[5] ^ codeword[6]
syndrome = (p3 << 2) | (p2 << 1) | p1
if syndrome:
codeword[syndrome - 1] ^= 1 # flip error bit
return [codeword[2], codeword[4], codeword[5], codeword[6]] # d1,d2,d3,d4
Repeat for all 128 codewords → 512 bits.
✅ Step 4: Analyze Decoded 512-bit (64-byte) Frames
After decoding, look for:
- ASCII text (flag format:
flag{...}, CTF{...})
- Repeating patterns → likely frame counters, timestamps, sensor IDs
- Incrementing values → telemetry counters
- CRC-16 or checksum at end → common in AX.25 or CCSDS
- Fixed headers → e.g.,
0xAA, 0x55, or 0x00 0x01
🔍 Check for CRC-16:
- Take first N bytes, compute CRC-16 (CCITT, XMODEM, etc.), see if matches last 2 bytes.
🔍 Check for byte alignment: If decoded bits aren't byte-aligned, try bit reversal, byte order, or bit stuffing removal.
🔍 Check for AX.25-style:
- Look for 0x03 0xF0 (UI frame control + PID)
- Or 0x82 0x00 (SSTV-like)
- Or FUNcube header: 4-byte sync, 2-byte length, etc.
✅ Step 5: Try Other Variants (If (7,4) Fails)
A. (15,11) Hamming
- 11 data bits → 15 encoded
- 894 / 15 = 59.6 → not integer
- But: 15 × 59 = 885 → 9 bits left → possible padding or sync
- Try: decode 59 × 11 = 649 bits → ~81 bytes → messy
B. Interleaved Hamming
- Data is interleaved before encoding to resist burst errors
- Try: reshape 894 bits into matrix (e.g., 6×149, 149×6), apply Hamming along rows/columns
C. Convolutional Code + Viterbi (e.g., CCSDS)
- But you said "Hamming", so less likely unless concatenated
- CCSDS often uses (255,223) Reed-Solomon + (7,1/2) convolutional
- But 894 bits doesn't fit 255-byte blocks
🚫 Unlikely unless you have longer frames or multiple frames combined
D. Bit Stuffing (AX.25 style)
- Look for 6 consecutive 1s → if followed by 0, it's stuffed
- Remove 0 after 6 ones → unstuff
- Then look for CRC
🔎 Test: Count runs of 1s. If you see 1111110, that’s a stuffed bit → remove the 0.
✅ Step 6: Check for Telemetry-Specific Formats
Common in CTFs:
- FUNcube Data Unit (FDU): 64-byte frames with (7,4) Hamming, CRC-16, counter
- AO-73 / BRICSat: Similar
- SSTV (Scottie, Martin): But usually audio, not raw bits
- AX.25 APRS: But usually shorter
👉 Try this: After (7,4) decode → 64 bytes → check:
- Bytes 0–3: sync word (e.g.,
0x12345678)
- Bytes 4–5: frame counter (increasing)
- Bytes 6–7: length
- Bytes 8–N: data
- Last 2 bytes: CRC-16
Use CRC reveng to find CRC type.
🧪 Recommended Action Plan
-
Try (7,4) Hamming decode with 896-bit padding:
- Pad each 894-bit payload with 2 bits (try 00, 01, 10, 11 → 4 variants)
- Split into 128 × 7-bit codewords
- Decode → 512 bits = 64 bytes
- Convert to hex, look for ASCII, counters, CRC
-
If no structure, try bit inversion (flip all bits before decoding)
-
If still no luck, try removing bit stuffing:
- Scan for
1111110 → remove the 0
- Then try (7,4) on remaining bits
-
Try (15,11) Hamming with 885-bit chunks (59 codewords), ignore last 9 bits
-
Check for CRC-16 in decoded data using crcmod or reveng
-
Look for repeating 4-byte values → likely frame counter or timestamp
-
Plot byte values (e.g., byte 4 across 16 frames) → should increase by 1 or 16
🏁 Expected Outcome
You'll likely find:
- Frame counter in bytes 4–7
- Sensor data (temperature, voltage, etc.) in middle
- Flag in ASCII or base64-encoded in last few bytes
- CRC-16 at end
🎯 Flag format: flag{...} or CTF{...} → look for readable text after decoding.
🛠️ Bonus: Tools & Scripts
# Example: (7,4) Hamming decode
def hamming_74_decode(bitstring_896):
bits = list(map(int, list(bitstring_896)))
decoded = []
for i in range(0, 896, 7):
cw = bits[i:i+7]
p1 = cw[0] ^ cw[2] ^ cw[4] ^ cw[6]
p2 = cw[1] ^ cw[2] ^ cw[5] ^ cw[6]
p3 = cw[3] ^ cw[4] ^ cw[5] ^ cw[6]
syndrome = (p3 << 2) | (p2 << 1) | p1
if syndrome:
cw[syndrome - 1] ^= 1
decoded.extend(cw[2:3] + cw[4:7]) # d1,d2,d3,d4
return ''.join(map(str, decoded))
Then:
for frame in frames:
payload = frame[18:] # remove preamble
padded = payload.ljust(896, '0') # or try '1', or '0' at end
decoded_bits = hamming_74_decode(padded)
data = bitstring_to_bytes(decoded_bits)
print(data.hex())
print(data.decode('ascii', errors='ignore'))
✅ Final Answer Summary
Most likely protocol: Custom telemetry using (7,4) Hamming code (common in CTFs and real satellites like FUNcube).
Steps:
- Remove 18-bit preamble.
- Pad to 896 bits (add 2 bits).
- Decode with (7,4) Hamming → 512 bits = 64 bytes.
- Look for ASCII, frame counters, CRC.
- If no success, try bit inversion, bit stuffing removal, or (15,11).
🔑 Flag is probably in the decoded 64-byte frame, possibly base64 or ASCII.
Good luck — you're very close! 🚀