Skip to content

Instantly share code, notes, and snippets.

@plugnburn
Forked from 140bytes/LICENSE.txt
Last active December 20, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugnburn/6142874 to your computer and use it in GitHub Desktop.
Save plugnburn/6142874 to your computer and use it in GitHub Desktop.
Whitespace text encoder

Whitespace Encoder

Encode any arbitrary text into a set of spaces, tabs and form-feeds. Just 132 bytes.

Usage

wsenc("I'm a hidden text!")

For a decoder, see this snippet.

function(t){return t.split("").map(function(n){return n.charCodeAt(0).toString(2).replace(/1/g,"\t").replace(/0/g," ")}).join("\f")}
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 plugnburn
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
{
"name": "wsenc",
"description": "Encode any arbitrary text into a set of spaces, tabs and form-feeds",
"keywords": [
"whitespace",
"text",
"encoder",
"steganography"
]
}
@atk
Copy link

atk commented Aug 6, 2013

How about:

function W(h,s){return 1+s?(s?'':'\f')+h.charCodeAt(0).toString(2).replace(/1/g,'\t').replace(/0/,' '):h.replace(/[^]/g,W)}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment