Skip to content

Instantly share code, notes, and snippets.

@jed
Forked from 140bytes/LICENSE.txt
Created May 27, 2011 08:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jed/994877 to your computer and use it in GitHub Desktop.
Save jed/994877 to your computer and use it in GitHub Desktop.
rehydrate hidden text a la @zoompf
// extracts text hidden using an encoding of spaces and tabs. for details, see slide 54 in
// http://www.blackhat.com/presentations/bh-usa-08/Hoffman/Hoffman-BH2008-CircumventingJavaScript.ppt
function(
a, // a dehydrated string consisting of tabs and spaces
b // (placeholder)
){
return a[ // return the string,
b="replace" // replacing it twice:
](
/./g,
a = function(
a
){
return a[1]
? String.fromCharCode( // the second time turning binary
parseInt(a, 2) // string into the target character
)
: +(a==" ") // and the first time turning spaces into 1 and tabs into 0
}
)[b]( // the first time was for every character
/.{7}/g, // and the second time for every seven
a
)
}
<body onload='document.body.innerHTML=function(a,b){return a[b="replace"](/./g,a=function(a){return a[1]?String.fromCharCode(parseInt(a,2)):+(a==" ")})[b](/.{7}/g,a)}(document.body.innerHTML)'>
</body>
function(a,b){return a[b="replace"](/./g,a=function(a){return a[1]?String.fromCharCode(parseInt(a,2)):+(a==" ")})[b](/.{7}/g,a)}
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
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": "hydrate",
"description": "rehydrate hidden text a la @zoompf",
"keywords": [
"obfuscation",
"hiding",
"invisible"
]
}
@tsaniel
Copy link

tsaniel commented Oct 30, 2011

What about

function(a,b,c,d,e){for(b=c='';d=a.charCodeAt(c);b+=[[String.fromCharCode(e|=(d&1^1)<<6-c%7)][++c%7||(e=0)]]);return b}
```?

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