Building a golfed rot13 encryptor is too easy because the letters are all the same order in the ASCII character space. Let's try a rot32 engine instead.
Your task is to build a function that takes a Base64 string as input and returns the same string but with each letter rotated 32 symbols from its original (in essence, with the first bit flipped).
The base64 encoding string to use for this problem is 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/
with a padding character of =
. This is to prevent solutions that would otherwise use or import a built-in Base64 library where strings normally start with A
instead of 0
.
Example inputs and outputs:
> rot32("THE+QUICK+BROWN+FOX+JUMPS+OVER+THE+LAZY+DOG=")
nb8ukoc6eu5liqhu9irudogjmuip8lunb8uf4tsu7ia=
> rot32("NB8UKOC6EU5LIQHU9IRUDOGJMUIP8LUNB8UF4TSU7IA=")
h5Eoei6C8oBfckboFclo7iadgocjEfoh5Eo9AnmoDc4=
> rot32("Daisy++daisy++give+me+your+answer+true/I+/+m+half+crazy++all+for+the+love+of+you")
7GOY2uuJGOY2uuMO/KuSKu2U+XuGTY0KXuZX+KvcuvuSuNGRLuIXG32uuGRRuLUXuZNKuRU/KuULu2U+
The shortest program to do so in any language wins.