skillfed

classical-cipher-analysis

Identify and solve classical ciphers encountered in CTF challenges through systematic analysis. The skill covers cipher identification via character set, frequency distribution, and index of coincidence, then applies targeted attacks for monoalphabetic substitution, Caesar/ROT variants, polyalphabetic ciphers like Vigenere, and transposition methods. Includes Kasiski examination for key-length recovery and known-plaintext techniques.

Classical Cipher Analysis helps you identify and break substitution, transposition, and polyalphabetic ciphers using frequency analysis and cryptanalysis techniques.

AI-generated summary based on this skill's SKILL.md

1,480 196 MIT updated by yaklang

Install

yaklang/hack-skills/classical-cipher-analysis · repository language: CSS

git clone https://github.com/yaklang/hack-skills
cp -r hack-skills/skills/classical-cipher-analysis ~/.claude/skills/classical-cipher-analysis
npx skillfed install yaklang/hack-skills/classical-cipher-analysis

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How to break substitution ciphers with classical-cipher-analysis?

classical-cipher-analysis helps you break substitution ciphers by applying frequency analysis to identify patterns in the ciphertext. Start by calculating the index of coincidence (IC) to confirm monoalphabetic substitution, then compare letter frequencies against expected English distributions. For simple Caesar variants, brute-force all 25 rotations. For more complex monoalphabetic ciphers, use digraph and trigraph analysis alongside known-plaintext attacks or crib dragging to recover the substitution key.

What is Kasiski examination and how does it crack Vigenere ciphers?

classical-cipher-analysis uses Kasiski examination to break Vigenere ciphers by finding repeated sequences in the ciphertext and calculating the distances between them. The greatest common divisor of these distances reveals the likely key length. Once key length is known, you can split the ciphertext into columns, treat each as a separate Caesar cipher, and apply frequency analysis to recover each key character. This method is essential for polyalphabetic cipher cracking in CTF challenges.

How does classical-cipher-analysis perform frequency analysis on encrypted text?

classical-cipher-analysis performs frequency analysis by counting letter occurrences in the ciphertext and comparing them to expected English letter distributions. It calculates the index of coincidence (IC) to distinguish monoalphabetic from polyalphabetic ciphers—monoalphabetic ciphers show IC values near 0.065, while random text shows ~0.038. Digraph and trigraph frequency analysis further refines plaintext recovery by identifying common letter pairs and triplets.

Can classical-cipher-analysis solve affine, Hill, and Playfair ciphers?

Yes, classical-cipher-analysis handles specialized classical ciphers including affine ciphers (brute-force all 312 valid key combinations), Hill ciphers (matrix inversion and known-plaintext attacks), and Playfair ciphers (digraph frequency analysis and grid reconstruction). Each method exploits the mathematical structure of the cipher to recover the key or plaintext without exhaustive search.

Does classical-cipher-analysis detect and decode base64, hex, and Morse?

classical-cipher-analysis includes detection and decoding for base64, hexadecimal, binary, and Morse-encoded text. It identifies encoding type by analyzing character sets and patterns, then applies the appropriate decoder. This feature is useful in CTF challenges where encoded layers wrap classical ciphers or where the plaintext itself is encoded rather than encrypted.

How does classical-cipher-analysis identify which cipher was used?

classical-cipher-analysis identifies ciphers by analyzing character set (letters only vs. symbols), frequency distribution shape, index of coincidence value, and repeating patterns. Transposition ciphers preserve letter frequencies; substitution ciphers distort them. Polyalphabetic ciphers show flattened IC. Rail fence and columnar transposition reveal themselves through anagram-like properties. This multi-factor approach narrows cipher type before applying targeted attacks.

SKILL.md

rendered from the published skill — quoted content, verbatim

SKILL: Classical Cipher Analysis — Expert Cryptanalysis Playbook

> AI LOAD INSTRUCTION: Expert classical cipher identification and breaking techniques for CTF. Covers cipher identification methodology (frequency analysis, IC, Kasiski), monoalphabetic substitution, Caesar/ROT, Vigenere, Enigma, affine, Hill, transposition ciphers, Bacon/Polybius/Playfair, and XOR ciphers. Base models often skip the identification step and jump to the wrong cipher type, or fail to recognize encoded (base64/hex) ciphertext that needs decoding before analysis.

0. RELATED ROUTING

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
skills/classical-cipher-analysis/SKILL.md

Related skills

Tags

frequency-distribution polyalphabetic-ciphers monoalphabetic-substitution key-length-detection cryptanalysis-automation encoding-detection matrix-based-crypto digraph-analysis ctf-challenges