Official BabyEncryption Discussion

Anybody looking at this still that I can share my thought process with?

Surely :smile:

Pretty easy challenge I should say, my phone calculator was enough to get a valid reverse equation

I know this is not so hard a challenge, but i’m going to start to be more active in the community starting from now
Anyone who need help, R is here

You have to use math and reverse the equotation.
The -18 can be done right away on the char as multiplication binds more then + or - so the first step is to substract 18.
Next step is to invert the modulus operation for which you have to find the so calles modulus inverse.
That means a mod b can be solved by finding the equivalent of a mod m = b where a*b = 1 mod m also known as a^-1

See: Online calculator: Modular Multiplicative Inverse Calculator
You will find out the inverse modulus for char * 123 % 256 is char * 179 % 256.
So here is a proper code to solve it:

def dec(msg):
	pt = []
	for char in msg:
		# inverse modulus of 123 is 179
		char = (179 * (char - 18)) % 256
		pt.append(char)
	return bytes(pt)

with open('msg.enc') as f:
	ct = bytes.fromhex(f.read())
pt = dec(ct)
print(pt)

I really wonder what calculator you have that allows you to run through the advanced euclidian algorithm to find the multiplative inverse? xD

Android’s calculator is overpowered, I know :face_with_hand_over_mouth: