⊕ a tessier-ashpool subsidiary


⊕ 2016-07-06

Often times it's fun to play with toy crypto puzzles, so for a quick one today I decided to do a quick writeup on my modern take on the ceaser cipher. Taking unicode (UTF-8 specifically) and flip the first bit. This is the same as rotating the alphabet by 0x8000 instead of 13. If you have run into this in any security capture the flag in the last few years than you know who was responsible and who to send hate mail to. It shows the same principles as a normal ROT-13 except for in a modern binary driven world that has a lot of encoding types! In fact it's simple to apply this to any bit fixed encoding such as UTF-16,UTF-32, etc.

For example the string: ROTx8000 has the interesting side effect of turning all your english letters into chinese characters!‽?! turns into this monstrosity (hope you have a good browser font):


Taking that same string again and it reverses it back to the original string. This is 100% useless, but I thought it was entertaining. Here is the example code:

#!/bin/env python
import sys

#Rotate by 0x8000 (UTF-8 rot)
def rotx8(s):
    y = ''
    for x in s:
            y += chr(ord(x) ^ 0x8000)
    return y

    print("Cannot rot UTF-8 (rot0x8000 / rot32768) string")

Use it like so: $ python ./rot8.py 'text to encode'