Skip to main content
Challenges Text shifted with a recursive function
Reverse engineering Medium Recursion Solves: 7

Text shifted with a recursive function

Author: CyberSamSU
Points
40

The following recursive functions shift each character depending on its position:

def fib(n):
    if n < 2:
        return 1
    return (fib(n - 1) + fib(n - 2)) % 256

def transform(s, i=0):
    if i == len(s):
        return []
    kod = (ord(s[i]) + fib(i)) % 256
    return [kod] + transform(s, i + 1)

When transform(bayroq) was executed, the following 18 numbers were generated:

67 66 91 85 84 89 136 103 85 141 184 246 82 219 212 64 179 149

Reverse operation: for each position i, ord(belgi) = (kod - fib(i)) mod 256.

Hints 2
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −4 pts Log in
Hint 2 −8 pts Log in
To submit a flag, log in.

First solvers

1. W.o.X 09.09.2026
2. Qodirxon Yoqubjonov 18.09.2026
3. Faxriddin Oripov 02.10.2026
4. Абдул 09.10.2026
5. Mirjaxon Qaxxarov 27.10.2026
6. Odam 05.11.2026
7. arcanum 11.11.2026