Skip to content

Instantly share code, notes, and snippets.

@plugnburn
Forked from 140bytes/LICENSE.txt
Last active March 14, 2018 01:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugnburn/6142901 to your computer and use it in GitHub Desktop.
Save plugnburn/6142901 to your computer and use it in GitHub Desktop.
Whitespace text decoder

Whitespace decoder

Decode any arbitrary text from a set of spaces, tabs and form-feeds encoded with this encoder. Just 135 bytes.

Usage

wsdec(hidden_text)
function(t){return t.split("\f").map(function(s){return String.fromCharCode(parseInt(s.replace(/\t/g,1).replace(/ /g,0),2))}).join("")}
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": "wsdec",
"description": "Decode any arbitrary text from a set of spaces, tabs and form-feeds encoded with wsenc encoder",
"keywords": [
"whitespace",
"text",
"decoder",
"steganography"
]
}
@atk
Copy link

atk commented Aug 6, 2013

The recursive replace pattern is really powerful for 140byt.es challenges:

function w(h,s){return s?String.fromCharCode(parseInt(s,2)):h.replace(/ /g,0).replace(/\t/g,1).replace(/([01]+)\f?/g,w)}

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