Anime Track Cipher
Anime Track Cipher
Platform: hackerlab | Category: Crypto | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2025-12-30 | Status: Solved Techniques: Known plaintext attack using flag format, Pattern recognition from song lyrics, Substitution cipher frequency analysis
Summary
Task: decrypt song lyrics encrypted with substitution cipher. Solution: known plaintext attack using flag format CODEBY{} to build substitution table, then identify song as Running in the 90s from Initial D anime.
Anime Track Cipher - hackerlab
Description
Мой друг сказал что пришел на почту текст его любимого трека из его любимого аниме. Но кто же знал что он решит приколоться и зашифрует его...
Task: decrypt the song lyrics and find the flag.
Analysis
- File cypher.txt contains encrypted song lyrics with the flag at the end
- Encrypted flag:
gwrndq{1b1a1xy_r_xn86_r0s1ea0} - Flag format: CODEBY{...} - this gives us the initial character mapping
Building mapping from flag format
gwrndq → CODEBY
g → c
w → o
r → d
n → e
d → b
q → y
Song identification
The encrypted text is the song "Running in the 90's" from the anime Initial D.
Using the known song lyrics as plaintext, we can build the complete substitution table.
Solution
Complete substitution table
python read-only • copy allowedmapping = { 'a': 't', 'b': 'n', 'c': 'w', 'd': 'b', 'e': 'f', 'g': 'c', 'i': 'k', 'j': 'm', 'k': 'i', 'l': 's', 'm': 'g', 'n': 'e', 'o': 'u', 'p': 'p', 'q': 'y', 'r': 'd', 's': 'r', 't': 'j', 'u': 'h', 'v': 'v', 'w': 'o', 'x': 'a', 'y': 'l', 'z': 'x' }
Decryption script
python read-only • copy allowed#!/usr/bin/env python3 cipher_flag = "gwrndq{1b1a1xy_r_xn86_r0s1ea0}" # Substitution mapping (cipher -> plain) mapping = { 'a': 't', 'b': 'n', 'c': 'w', 'd': 'b', 'e': 'f', 'g': 'c', 'i': 'k', 'j': 'm', 'k': 'i', 'l': 's', 'm': 'g', 'n': 'e', 'o': 'u', 'p': 'p', 'q': 'y', 'r': 'd', 's': 'r', 't': 'j', 'u': 'h', 'v': 'v', 'w': 'o', 'x': 'a', 'y': 'l', 'z': 'x' } result = "" for c in cipher_flag: if c.lower() in mapping: result += mapping[c.lower()] else: result += c print(f"Decrypted: {result}") # Output: codeby{REDACTED} print(f"Flag: CODEBY{{{result[7:-1]}}}")
Decryption
gwrndq{1b1a1xy_r_xn86_r0s1ea0}
↓
CODEBY{REDACTED}
Theory
Substitution Cipher - one of the oldest encryption methods, where each letter of the alphabet is replaced by another letter according to a fixed table.
Known Plaintext Attack - a cryptanalysis method where the attacker knows part of the plaintext and the corresponding ciphertext. In this case:
- Known:
gwrndq=CODEBY(flag format) - This gives 6 character pairs to start building the table
Files
task.zip→cypher.txt- encrypted lyrics of "Running in the 90's"