# I found this super cool function on stack overflow \o/ https://stackoverflow.com/questions/2267362/how-to-convert-an-integer-to-a-string-in-any-base defnumberToBase(n, b): if n == 0: return [0] digits = [] while n: digits.append(int(n % b)) n //= b return digits[::-1]
assertlen(flag) <= 45
flag = int.from_bytes(flag, 'big')
base = int(input("Give me a base! "))
if base < 2: print("Base is too small") quit() if base > 256: print("Base is too big") quit()
print(f'Here you go! {sum(numberToBase(flag, base))}')
context(os='linux', arch='amd64', log_level='debug') m = 0 n = 1 for i in trange(2,256): p = remote('basic-sums.chal-kalmarc.tf', 2256) p.sendlineafter(b'Give me a base! ',str(i).encode()) p.recvuntil(b'go! ') m0 = int(p.recvline()) n0 = i-1 m = crt([m,m0],[n,n0]) n = lcm(n,n0) p.close() print(long_to_bytes(int(m))) # b'kalmar{At_least_it_wasnt_lattices_right???!?}'
# FROM python:3 import random withopen("flag.txt","rb") as f: flag=f.read() for i inrange(2**64): print(random.getrandbits(32)+flag[random.getrandbits(32)%len(flag)]) input()