← Back to Writeups
CUSTOMMediumReversing

Haskell

XESXOR9/2/20261 min read
#reversing#custom#medium#functional_code_analysis#paired_arithmetic_reverse

Haskell

Platform: CUSTOM | Category: Reversing | Type: Challenge | Difficulty: Medium | OS: N/A | **Author: XESXOR Techniques: functional_code_analysis, paired_arithmetic_reverse

Summary

Walkthrough of the CUSTOM Reversing Haskell. Language: Haskell. Source code provided. Functional flag checker using recursive list transformation.

Description

Language: Haskell. Source code provided. Functional flag checker using recursive list transformation.

Analysis

The calculate1 function processes the list in pairs:

haskell
calculate1 (x:[]) = [x*4]
calculate1 (x:y:[]) = [(x+y)*5] ++ (calculate1 [y])  -- = [(x+y)*5, y*4]
calculate1 (x:y:xs) = (calculate1 [x,y]) ++ (calculate1 xs)

For each pair (x, y) of ASCII codes from the input, two values are generated: (x+y)*5 and y*4.

Target array: [730,304,680,284,860,196,505,204,1020,408,1000,396,995,408,995,392,975,392,1130,500] ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Solution

For each pair (a, b) in the target array:

  • y = b / 4
  • x = a / 5 - y
python
target = [730,304,680,284,860,196,505,204,1020,408,1000,396,995,408,995,392,975,392,1130,500]
flag = ""
for i in range(0, len(target), 2):
    y = target[i+1] // 4
    x = target[i] // 5 - y
    flag += chr(x) + chr(y)
# FLAG{REDACTED}

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

Key Takeaways / Lessons

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

Crafted by XESXOR Research • 2026-03-09 • CUSTOM • Haskell • Difficulty: Medium