deffunc(num): result = [] while num != 1: num = num * 3 + 1if num % 2else num // 2 result.append(num)
return result
if __name__ == '__main__': print('Your input is not the FLAG!') inp = input() iflen(inp) != 27: print('length error!') sys.exit(-1) for i, ch inenumerate(inp): ret_list = func(ord(ch)) s = '' for idx inrange(len(ret_list)): s += str(ret_list[idx]) s += str(ret_list[(len(ret_list) - idx - 1)])
md5 = hashlib.md5() md5.update(s.encode('utf-8')) if md5.hexdigest() != check[i]: sys.exit(i)
check = [ 'e5438e78ec1de10a2693f9cffb930d23', '08e8e8855af8ea652df54845d21b9d67', 'a905095f0d801abd5865d649a646b397', 'bac8510b0902185146c838cdf8ead8e0', 'f26f009a6dc171e0ca7a4a770fecd326', 'cffd0b9d37e7187483dc8dd19f4a8fa8', '4cb467175ab6763a9867b9ed694a2780', '8e50684ac9ef90dfdc6b2e75f2e23741', 'cffd0b9d37e7187483dc8dd19f4a8fa8', 'fd311e9877c3db59027597352999e91f', '49733de19d912d4ad559736b1ae418a7', '7fb523b42413495cc4e610456d1f1c84', '8e50684ac9ef90dfdc6b2e75f2e23741', 'acb465dc618e6754de2193bf0410aafe', 'bc52c927138231e29e0b05419e741902', '515b7eceeb8f22b53575afec4123e878', '451660d67c64da6de6fadc66079e1d8a', '8e50684ac9ef90dfdc6b2e75f2e23741', 'fe86104ce1853cb140b7ec0412d93837', 'acb465dc618e6754de2193bf0410aafe', 'c2bab7ea31577b955e2c2cac680fb2f4', '8e50684ac9ef90dfdc6b2e75f2e23741', 'f077b3a47c09b44d7077877a5aff3699', '620741f57e7fafe43216d6aa51666f1d', '9e3b206e50925792c3234036de6a25ab', '49733de19d912d4ad559736b1ae418a7', '874992ac91866ce1430687aa9f7121fc'] deffunc(num): result = [] while num != 1: num = num * 3 + 1if num % 2else num // 2 result.append(num) return result
for i inrange(1,128): a = func(i) s = '' for idx inrange(len(a)): s += str(a[idx]) s += str(a[(len(a) - idx - 1)]) md5 = hashlib.md5() md5.update(s.encode('utf-8')) b = md5.hexdigest() for j inrange(27): if b == check[j]: print j,chr(i)