Tags: misc
Rating:
We're given a program source code file that appears to be mostly empty.
Let's hexdump it to see if it really is mostly empty.
$ xxd hello_world.cpp
As we can see, it actually isn't empty. It's filled with a bunch of 0x20
and 0x09
. 0x20
is a space, and 0x09
is a tab. So while it looks like there's nothing there, this program is actually chock full of whitespace. We can also see that these spaces and tabs alternate between each other almost randomly. I wonder if they're encoding some kind of data?
Because only spaces and tabs are featured, intuition tells me that they must be encoding binary.
This is a little script I made to go through the file and convert the spaces and tabs to binary.
#!/usr/bin/env python3
with open("hello_world.cpp", "r") as f:
lines = f.readlines()
for line in lines:
binary = ""
for c in line[2::].strip("\n"):
binary += "0" if c == " " else "1"
print("{:0>8}".format(binary)) # Pad with leading 0s if len < 8
Alright. Now that we have our bytes, all that's left is to convert them to ASCII. I'm using RapidTables here.