Challenges
Check with modular arithmetic
Reverse engineering
Easy
Modular arithmetic
Solves: 8
Check with modular arithmetic
Author: CyberSamSU
Points
18
Many crackme programs "encrypt" each character using a single linear formula: v = (kod * a + b) mod 256, where kod is the ASCII code of the character, a and b are constant numbers given in the program.
To reverse this, a modular inverse is needed: the inverse of a modulo mod 256 is a_inv such that (a * a_inv) mod 256 == 1. In Python 3.8+, this can be found with a single call: a_inv = pow(a, -1, 256).
Given: a = 67, b = 86. Recover each character from the following sequence of v values:
156 89 161 204 3 137 135 204 175 216 51 221 99 130 209 32 56 13
Formula: kod = ((v - b) * a_inv) mod 256, then chr(kod).
Theory: learn the topic
Learning paths:
Reverse engineering 101
To submit a flag, log in.