## Test how the function in the description really works ```python= flag="picoCTF{this_is_a_fake_flag}" print(len(flag)) enc="" for i in range(0, len(flag), 2): print(i) print(bin(ord(flag[i]))) print(f'{bin(ord(flag[i]) << 8)}+{bin(ord(flag[i+1]))} ={bin((ord(flag[i]) << 8) + ord(flag[i + 1]))}',(ord(flag[i]) << 8) + ord(flag[i + 1])) enc+= chr((ord(flag[i]) << 8) + ord(flag[i + 1])) print(enc) ``` => `灩捯䍔䙻瑨楳彩獟慟晡步彦污杽` ## solution script ```python= text="灩捯䍔䙻ㄶ形楴獟楮獴㌴摟潦弸弲㘶㠴挲ぽ" flag="" for i in range(len(text)): print(f'{ord(text[i]):015b}') ord1="0b"+f'{ord(text[i]):015b}'[0:7] flag+=chr(int(ord1,2)) ord2="0b"+f'{ord(text[i]):015b}'[8:15] flag+=chr(int(ord2,2)) print(flag) ``` ### explanation ASCII ranges from 0 to 127, which never exceeds 128(`0b10000000`, with seven`0`), so ASCII order's maximum(`0b1111111`) is 7 bits. The challenge shifts `flag[i]` 8 bits left, so if the original `flag[i]` is <font color="tomato">1101011</font>, it will become **15 bits** long: <font color="tomato">1101011</font>00000000. Then it adds `flag[i+1]`. For example, if `flag[i+1]` is 00000000<font color="LimeGreen">1100101</font>, then the encoded flag will be <font color="tomato">1101011</font>0<font color="LimeGreen">1100101</font>. As we can see, from 0 to 7th, the bits in encoded flag belongs to `flag[i]`, while 8 to 15th belongs to `flag[i+1]`. Therefore, we can convert the encoded flag to unicode order, convert the order to a 15-bit binary number, then break them back to the order of`flag[i]` and `flag[i+1]`.