javascript - What exactly Does this code do? -


/* no source you! *// /.source.replace(/.{7}/g,function(w){ document.write(string.fromcharcode(parseint(w.replace(/ /g,'0').replace(/   /g,'1'),2)))}); 

i don't know javascript looks encryption of sort, believe comment somehow related, sorry little knowledge on decryption, thankyou!

this quite cute. splits "source" 7 character long substrings (.{7}) , replaces whitespace characters 0 or 1, interprets these 0 , 1 strings binary number (parseint(.., 2)) , turns them character (string.fromcharcode). whitespace source written regex literal (/ /).

essentially, source code encoded "invisible" whitespace , piece of code turns actual source code.

since source written dom can read it, it's useless actual "protection"; obfuscation useless. cannot hide javascript code, since browser couldn't execute it. if browser must execute it, must publicly visible somehow, somewhere. again, it's cute.


Comments