← Back to Writeups
CUSTOMMediumCrypto

Prisoner — Columnar Transposition

XESXOR9/2/20261 min read
#crypto#custom#medium#columnar_transposition_decrypt

Prisoner — Columnar Transposition

Platform: CUSTOM | Category: Crypto | Type: Challenge | Difficulty: Medium | OS: N/A | **Author: XESXOR Techniques: columnar_transposition_decryption

Summary

Walkthrough of the CUSTOM Crypto Prisoner — Columnar Transposition. Task: Decrypt a columnar transposition cipher with 48-character ciphertext. Solution: Brute-force column counts using divisors of text length, finding 6 columns produces the flag.

Description

Encrypted message: s{_pldmlpIeoeoaybsvs__n?c_estiu}tiniota·ft_b__l

Analysis

Columnar transposition cipher. The text is written into a table row by row and read column by column (or vice versa). We need to find the correct number of columns.

Ciphertext length: 48 characters. Divisors: 2, 3, 4, 6, 8, 12, 16, 24, 48.

Solution

python
#!/usr/bin/env python3
ciphertext = "s{_pldmlpIeoeoaybsvs__n?c_estiu}tiniota·ft_b__l"
length = len(ciphertext)  # 48

# Try different column counts
for cols in [2, 3, 4, 6, 8, 12]:
    rows = length // cols
    
    # Write by columns, read by rows
    grid = [''] * rows
    idx = 0
    for c in range(cols):
        for r in range(rows):
            if idx < length:
                grid[r] += ciphertext[idx]
                idx += 1
    
    result = ''.join(grid)
    if 'spbctf' in result.lower() or 'flag' in result.lower():
        print(f"Columns={cols}: {result}")
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

# Columns=6: spbctf{REDACTED}

With 6 columns we get readable text. ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Key Takeaways / Lessons

  • Mastering columnar_transposition_decryption was key to this challenge.
  • Always check for common misconfigurations and verify assumptions.

Crafted by XESXOR Research • 2026-03-08 • CUSTOM • Prisoner — Columnar Transposition • Difficulty: Medium