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.
To submit a flag, log in.