Decoding with Base64

for all your pirating needs
06 Nov 2023

When going on reddit looking to download some shady stuff, you've probably encountered some strange code like this:

aWYgeW91IGFyZSByZWFkaW5nIHRoaXMsIGkgbG92ZSB5b3UgPDMu

This cryptic junk - it's base64, and is commonly used to easily encrypt MEGA drive links and keeping them from being flagged, so you can continue to watch shitty romcoms for nada.

So how does it work?

Let's take a string, ROACH for example, and split it into UTF-8 characters:

R; // U+0052
O; // U+004F
A; // U+0041
C; // U+0043
H; // U+0048

And then convert them to 8-bit binary:

R; // 01010010
O; // 01001111
A; // 01000001
C; // 01000011
H; // 01001000

Now divide them into 6 bit characters, and match them to the base64 alphabet.

Oh wait.

Because 8 * 5 doesn't divide perfectly by 3s, We'll have to pad it with 0s.

ROACH
010100100100111101000001010000110100100000
010100100100111101000001010000110100100000padding
Uk9BQ0g=

And that's it. We have successfully converted ROACH into Uk9BQ0g=.

If you want to try converting it without having to do it manually, you can go here.