Hiding Data in Empty Space Characters

lurn_mor1 pts1 comments

Hiding Data in Empty Space

It's the biggest key on your keyboard, but is often ignored for the intrinsic value it adds to the reading experience.

You want proof? Consider how hard it is to read this sentence, especially when all the spaces between the words have been removed via CSS using the rarely-used 'word-spacing' modifier! (Yo, rollover this section and the spaces will reinflate for easy reading!)

And for some reason, the Unicode spec has over a dozen variations of the lowly space character I culled a list of them and have them categorized for you below:

NameHTML EntityUsed for<br>Tab &#9; Typically 4 to 8 spaces<br>Space &#32; Default space width — usually half of 'm' in the font<br>No-Break Space &nbsp; or &#160; Same width, Non-breaking<br>En Quad &#8192; Width of 1 'n' in the font<br>Em Quad &#8193; Width of 1 'm' in the font<br>En Space &#8194; Width is half an 'm'<br>Em Space &#8195; Width equals the current font height<br>Three-Per-Em Space &#8196; Width is 1/3 an 'm'<br>Four-Per-Em Space &#8197; Width is 1/4 an 'm'<br>Six-Per-Em Space &#8198; Width is 1/6 an 'm'<br>Narrow No-Break Space &#8239; Narrower than default space width, Non-breaking<br>Medium Mathematical Space &#8287; Width is 4/18 of 'm'<br>Ideographic Space &#12288; Width equals one Chinese character

In keeping with my Anti-A.I. theme of obfuscating information from LLMs and search engine spiders, I've decided to hide my message right out there in the big open space around my normal content:

Copy that big empty space above with your device and I'll show you what's happening in the background. I'll admit, there's very limited use to this type of data obfuscation, and there are better ways to communicate in secret via anonymous web pages.

Literally Reading Between the Lines

However, the novelty of directing readers to the 'empty space' wherein they can copy and paste it into a decoder like mine is cool and unexpected. it survives pasting into text document and back, and you could feasibly email someone a 'blank' message for them to decode on arrival. although I tried to email myself the blank space, and it delivered nothing back. Might be my mail client, or SMTP itself...

This is no more complicated than a Captain Crunch Secret Decoder Ring, it's just using rarely-used unicode 'space' characters to replace digits of each characters unicode number. However, A.I. and web crawlers will see it as garbage, and humans will see it as empty (blank) space. Now no one can read it! Just like a real blogger!

Jokes aside, I wanted to create a very dumb replacement cypher for copy and pasting elsewhere for decoding. Not surprisingly, Javascript handles a lot of this type of data juggling easily, using .codePointAt() and .fromCharCode() to turn those lists of numbers back into unicode characters! I can give away my (terrible) Javascript code and let anyone host their own 'empty space' encode/decoder!

Message to be Hidden: (Emoji's work! -ish?)

Encode<br>Hiding Data in Empty Space Web Demo 👃💩😫☠️

Open Documented Javascript in New Window

We'll convert the text to Unicode Numbers and put them in a list (array), which helps obfuscate the actual space character (' ') into digits ('32'). Less work required and no need to worry about spaces in our array!

While testing this, I found that the copy/paste routine turns TAB &#9; , &nbsp; or &#160; into regular spaces &#32; . No matter, we can still work with it.

Then we'll convert each number into an encoded array (using a .map function), and use the tab character encoded space character (&#32;) to split each separate array of parts (letters) into one long string (sentence). For readings sake, the content in the below is raw HTML, and therefore easier to see the encoding going on. You'd copy this text and embed it on a web page, where it'll show up as empty space and maintain it's format:

Here's that same HTML inserted to display in the empty Space below, it's invisible to the naked eye, and you can still copy it and see it decode! I've highlighted it so you can see the 'emptiness' yourself.

So now we have our Secret Message hidden in Empty Space. How do I turn this back into a readable state? Read on...

Decoding the Empty Space

It's a bit funky here, as what you copy is no longer that easily discernible list of numbers. It'll take another nested loop to decode the result. Paste your 'empty space' message into the below, and click the 'Decode' button to process it:

Decode

Warning: Triggers Alert<br>Getting an Error or No result? You might have copied a Carriage Return [CR] with the rest of the blank space, which decodes to Unicode Number 10. If you see a leading or trailing 10 in your array result, remove the first or last carriage return in your pasted 'empty space' and try again! Next version of the code will strip these out automatically! (LOL)

Open Documented Javascript in New Window

Your Empty Space turned into 'Space' Unicode Characters:

Looping through that result, we can turn those encoded spaces into unicode numbers...

space empty width unicode copy spaces

Related Articles