← Back to Writeups
CUSTOMEasyCrypto

Неразгаданный шифр (notsolvedcipher)

XESXOR9/2/20262 min read
#crypto#custom#easy#known_key_attack#vigenere_decryption

Неразгаданный шифр (notsolvedcipher)

Platform: CUSTOM | Category: Crypto | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: known_key_attack, vigenere_decryption

Summary

Walkthrough of the CUSTOM Crypto Неразгаданный шифр (notsolvedcipher). Task: Decrypt ciphertext with provided key. Solution: Apply Vigenère cipher decryption using the given key to transform KRRRPR{...} to CODEBY{...}.

Description

В файле содержиться ключ и шифр, должно быть легко его разгадать?

Analysis

The file notsolvedcipher.txt contains:

  • Ciphertext: KRRRPR{memlbrjvuxxrfa}
  • Key: idonotknow

Signs of Vigenère cipher:

  1. Format KRRRPR{...} should decrypt to CODEBY{...}
  2. Key is provided — classic sign of a polyalphabetic cipher
  3. Task name "Неразгаданный шифр" (Unsolved cipher) — ironic reference to the history of the Vigenère cipher

Historical Note

The Vigenère cipher was considered "unbreakable" for about 300 years (le chiffre indéchiffrable), until Charles Babbage and Friedrich Kasiski developed methods to crack it in the 19th century. ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Solution

python
#!/usr/bin/env python3
"""
Vigenère cipher decryption with known key
"""

def vigenere_decrypt(ciphertext: str, key: str) -> str:
    """
    Decrypt Vigenère cipher with known key.
    
    Args:
        ciphertext: Encrypted text
        key: Decryption key
    
    Returns:
        Decrypted plaintext
    """
    result = []
    key = key.lower()
    key_index = 0
    
    for char in ciphertext:
        if char.isalpha():
            # Determine base (uppercase or lowercase)
            base = ord('A') if char.isupper() else ord('a')
            
            # Calculate shift from key character
            shift = ord(key[key_index % len(key)]) - ord('a')
            
            # Decrypt: subtract shift (reverse of encryption)
            decrypted = chr((ord(char) - base - shift) % 26 + base)
            result.append(decrypted)
            
            # Move to next key character
            key_index += 1
        else:
            # Non-alphabetic characters pass through unchanged
            result.append(char)
    
    return ''.join(result)
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍


# Challenge data
ciphertext = "KRRRPR{memlbrjvuxxrfa}"
key = "idonotknow"

# Decrypt
plaintext = vigenere_decrypt(ciphertext, key)
print(f"Ciphertext: {ciphertext}")
print(f"Key: {key}")
print(f"Plaintext: {plaintext}")

Decryption Verification

PositionCipherKeyShiftResult
0Ki8C
1Rd3O
2Ro14D
3Rn13E
4Po14B
5Rt19Y
...............
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Alternative Tools

  • CyberChef: Recipe "Vigenère Decode" with key
  • dcode.fr: Online Vigenère decoder
  • Rumkin.com: Cipher tools

Related Techniques

  • Without key: Kasiski attack to determine key length
  • Partial key: Frequency analysis for recovery
  • Known plaintext: Calculate key from plaintext/ciphertext pair ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Key Takeaways / Lessons

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

Crafted by XESXOR Research • 2025-12-25 • CUSTOM • Неразгаданный шифр (notsolvedcipher) • Difficulty: Easy