Crypto - Password Guesser
Can you figure out my password, I lost it - vishiswoz
Last updated
Can you figure out my password, I lost it - vishiswoz
Last updated
At first, it's not clear on how to approach the problem. Very little information is given and the charset of the password was only shared in the discord.
We pay special attention to this line assert math.prod(pl) % P == sum(pl) % P
, as well as the modulus (13^37) which is our only clue on how to solve the problem.
The length of counts is 89, whereas the length of string.printable is 100. Therefore, if we find the 11 invalid characters, then all we need to do is sort the password and we can get the flag.
However, finding all the possible combinations would require 100C89 or 141629804643600 iterations, which is infeasible.
Since the modulus is 13^37, therefore if many multiples of 13 were there in the password, then the condition of assert math.prod(pl) % P == sum(pl) % P
wouldn't be satisfied since math.prod(pl)
might be a multiple of 13^37 and would be 0 mod P.
In many of my test runs, the multiples of 13 made the product a multiple of the modulus, failing the assertion. I can only speculate here, but I assumed that the authors ran into the same problem and removed them, and chose the password randomly from the remaining characters.
Since there were 8 multiples of 13 in string.printable
, we remove them and check the remaining 92C89 or 125580 possible combinations