← Back to Writeups
CUSTOMEasyReversing

Keygen Me

XESXOR9/2/20261 min read
#reversing#custom#easy#affine_cipher_implementation#keygen_generation

Keygen Me

Platform: CUSTOM | Category: Reversing | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: affine_cipher_implementation, keygen_generation

Summary

Walkthrough of the CUSTOM Reversing Keygen Me. Language: C. Source code provided. Generate serial for email spbctf2017@forkbomb.ru.

Description

Language: C. Source code provided. Generate serial for email spbctf2017@forkbomb.ru.

Analysis

The check_serial function applies an affine cipher to each letter of the email:

c
val_em = ((uint8_t)*em | 0x20) - 'a';  // lowercase, 0-25
val_em = ((A * val_em) % MODULE) + 'a'; // A=7, MODULE=26

Only alphabetic characters are processed (digits, @, . are skipped).

Solution

python
email = "spbctf2017@forkbomb.ru"
serial = ""
for c in email:
    if c.isalpha():
        val = ((7 * (ord(c.lower()) - ord('a'))) % 26) + ord('a')
        serial += chr(val)
# REDACTED

‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Letters from email: s,p,b,c,t,f,f,o,r,k,b,o,m,b,r,u → REDACTED ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Key Takeaways / Lessons

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

Crafted by XESXOR Research • 2026-03-09 • CUSTOM • Keygen Me • Difficulty: Easy