This page shows ECMAScript (JavaScript) obfuscation done with the ECMAScript Formatter using the optional Obfuscation capability. It contains ECMAScript sample code, its obfuscated version, and the generated obfuscation map of names to mangled names.

ECMAScript (JavaScript) Sample Code before Obfuscation

The program here draws a cute clock face near your mouse cursor, and updates it every second.
1. Click to see unobfuscated JavaScript source code
2. Click to see the unobfuscated HTML page
3. Click to see the web page with mouse events to run the JavaScript

ECMAScript (JavaScript) Code after Obfuscation

This is the actual obfuscated JavaScript source code for that same cute clock. Don't expect to see a lot; it is obfuscated, and doesn't have any line breaks!
4. Click to see obfuscated JavaScript source code
5. Click to see the obfuscated HTML page
6. Click to see the obufscated web page with mouse events to run the JavaScript

Because the obfuscated text is difficult to see without line breaks, we've reproduced it again below, adding line breaks every 80 characters so you have a chance of seeing it with your browser. Compared to the original, notice that comments are gone, names have been scrambled and length-minimized, text strings obscured. Constants have their radix twiddled, line breaks removed (except for those we added back for visibility). The obfuscator has also scrambled some variable names found both inside text strings and in the code. The obfuscator uses a special list provided by the user to define names that should be preserved, ensuring that public interfaces and accesses to public libraries remain valid (e.g,. "document", "write").


function (){clearTimeout(); if (){.style.visibility='\150i\144d\x65n'; .st
yle.visibility='h\151d\144e\x6e'; .style.visibility='\150i\x64\144e\156'; .st
yle.visibility='\150i\x64\144e\x6e'; .style.visibility='\150\151d\144e\x6e'; }
else if (){for (i=0; i<.length; i++)document.getElementById('\x6dz\x44\x61t\1
45'+i).style.visibility="\150i\x64\144e\x6e"; for (i=0; i<O; i++)document.getEl
ementById('mzF\141c\x65'+i).style.visibility="\150id\144e\x6e"; for (i=0; i<.l
ength; i++)document.getElementById('\155z\x53\145c\x6fn\144\163'+i).style.visib
ility="\150i\x64\x64\x65n"; for (i=0; i<.length; i++)document.getElementById('
\155z\x4d\151n\165\164\145s'+i).style.visibility="\x68i\x64d\145\x6e"; for (i=0
; i<.length; i++)document.getElementById('m\172H\157u\x72\163'+i).style.visibi
lity="\150i\x64\144e\x6e"; }else if (){for (i=0; i<.length; i++)document.getE
lementById('\x6e\163D\x61\x74\145'+i).style.visibility="h\151d\x64\x65\x6e"; fo
r (i=0; i<O; i++)document.getElementById('\156s\106a\x63\145'+i).style.visibili
ty="hid\144\145n"; for (i=0; i<.length; i++)document.getElementById('n\x73S\x6
5c\157nd\163'+i).style.visibility="h\151\144d\x65\156"; for (i=0; i<.length; i
++)document.getElementById('\156\x73\x4d\x69n\x75\164\145\x73'+i).style.visibil
ity="h\151\144d\x65\x6e"; for (i=0; i<.length; i++)document.getElementById('\x
6es\110o\x75\x72\163'+i).style.visibility="\150i\144de\156"; }}function (){cle
arTimeout(); }function o(Y){=(|)?Y.pageY+-(window.pageYOffset):event.y+;
=(|)?Y.pageX+:event.x+; } ()?window.onMouseMove=o:document.onmousemove=o;f
unction (){time=new Date(); =time.getSeconds(); I=-.157e1+Math.PI*/036; =ti
me.getMinutes(); min=-.157e1+Math.PI*/036; hr=time.getHours(); =-.1575e1+Math
.PI*hr/6+Math.PI*parseInt(time.getMinutes())/0550; if (){.style.top=window.do
cument.body.scrollTop; .style.top=window.document.body.scrollTop; .style.top=
window.document.body.scrollTop; .style.top=window.document.body.scrollTop; .s
tyle.top=window.document.body.scrollTop; }else if (){for (i=0; i<O; i++){var 
=document.getElementById('\155\172F\x61c\145'+i);.style.top=y[i]+*Math.sin(-.
10471e1+i**Math.PI/0264)+; .style.left=x[i]+*Math.cos(-.10471e1+i**Math.PI
/0264); }for (i=0; i<.length; i++){var =document.getElementById('mz\110o\x75\
162s'+i);.style.top=y[i]++(i*)*Math.sin()+; .style.left=x[i]+A+(i*)*Math
.cos(); }for (i=0; i<.length; i++){var =document.getElementById('mz\x4d\151\
x6e\x75\164\145s'+i);.style.top=y[i]++(i*)*Math.sin(min)+; .style.left=x[i
]+A+(i*)*Math.cos(min); }for (i=0; i<.length; i++){var =document.getElementB
yId('m\172Se\143o\x6ed\163'+i);.style.top=y[i]++(i*)*Math.sin(I)+; .style.
left=x[i]+A+(i*)*Math.cos(I); }for (i=0; i<.length; i++){var =document.getEl
ementById('\x6dz\x44a\164\145'+i);.style.top=Dy[i]+*.15e1*Math.sin(+i**Math
.PI/0264)+; .style.left=Dx[i]+*.15e1*Math.cos(+i**Math.PI/0264); }}if ( |
| ){for (i=0; i<O; i++){var =()?document.layers['n\x73Fa\143\x65'+i]:[i].st
yle; .top=y[i]+*Math.sin(-.10471e1+i**Math.PI/0264)+; .left=x[i]+*Math.co
s(-.10471e1+i**Math.PI/0264); }for (i=0; i<.length; i++){var =()?document.l
ayers['ns\110\157u\x72s'+i]:[i].style; .top=y[i]++(i*)*Math.sin()+; .lef
t=x[i]+A+(i*)*Math.cos(); }for (i=0; i<.length; i++){var =()?document.laye
rs['n\x73M\x69n\165\164\x65s'+i]:[i].style; .top=y[i]++(i*)*Math.sin(min)+
; .left=x[i]+A+(i*)*Math.cos(min); }for (i=0; i<.length; i++){var =()?docu
ment.layers['ns\123e\x63\157nds'+i]:[i].style; .top=y[i]++(i*)*Math.sin(I)+
; .left=x[i]+A+(i*)*Math.cos(I); }for (i=0; i<.length; i++){var =()?docum
ent.layers['\x6e\x73\x44a\164e'+i]:[i].style; .top=Dy[i]+*.15e1*Math.sin(+i
**Math.PI/0264)+; .left=Dx[i]+*.15e1*Math.cos(+i**Math.PI/0264); }}-=;}
function (){if (){.style.visibility='\166\151s\151b\x6c\145'; .style.visibi
lity='\166i\x73\151b\x6ce'; .style.visibility='\166i\x73\151b\x6ce'; .style.v
isibility='v\151\163i\x62\154\145'; .style.visibility='vis\151\142l\x65'; }els
e if (){for (i=0; i<.length; i++)document.getElementById('mzD\141\164e'+i).st
yle.visibility="\x73h\x6fw"; for (i=0; i<O; i++)document.getElementById('\155\1
72F\x61\143e'+i).style.visibility="\163h\x6f\167"; for (i=0; i<.length; i++)do
cument.getElementById('m\172\123e\143o\x6eds'+i).style.visibility="\163h\x6f\x7
7"; for (i=0; i<.length; i++)document.getElementById('mz\x4din\165\164\145\x73
'+i).style.visibility="\163ho\167"; for (i=0; i<.length; i++)document.getEleme
ntById('mz\x48ou\162\x73'+i).style.visibility="\163h\x6f\x77"; }else if (){for
(i=0; i<.length; i++)document.getElementById('\156\x73D\141t\145'+i).style.vis
ibility="s\150\157w"; for (i=0; i<O; i++)document.getElementById('nsF\141\143e'
+i).style.visibility="\163\150o\x77"; for (i=0; i<.length; i++)document.getEle
mentById('\156s\x53e\143o\x6e\144s'+i).style.visibility="\163h\x6f\167"; for (i
=0; i<.length; i++)document.getElementById('\156s\115i\x6e\165\164\x65\163'+i)
.style.visibility="sho\167"; for (i=0; i<.length; i++)document.getElementById(
'\156s\x48o\165r\x73'+i).style.visibility="sho\167"; }=()?window.pageYOffset:
0; Dy[0]=Math.round([0]+=(()-[0])*speed); Dx[0]=Math.round(e[0]+=(()-e[0])*
speed); for (i=1; i<.length; i++){Dy[i]=Math.round([i]+=(Dy[i-1]-[i])*speed)
; Dx[i]=Math.round(e[i]+=(Dx[i-1]-e[i])*speed); }y[0]=Math.round([0]+=(()-[0
])*speed); x[0]=Math.round([0]+=(()-[0])*speed); for (i=1; i<O; i++){y[i]=Ma
th.round([i]+=(y[i-1]-[i])*speed); x[i]=Math.round([i]+=(x[i-1]-[i])*speed)
; }(); =setTimeout(((''))+'(\051',024); }

Obfuscated Symbol Cross Reference

The obfuscator produces a cross reference mapping obfuscated symbols to the original symbols, so that obfuscated code in the field can still be decoded, if necessary, by you, the script owner. Notice that certain symbols are preserved (we don't show them all) to enable access to the windowing environment in which this script runs. (We provide a complete preserved word list for using with the obfuscator as part of the product). In fact, by reversing this map and running the obfuscator, you can reproduce the formatted output we started with, without, of course, the comments. Of course, you can only do this if you have this map, which you had to obtain by obfuscating the file in the first place.


### Obfuscated Identifiers ###
Clear -> 
ClockAndAssign -> 
ClockFromMouseX -> 
ClockFromMouseY -> 
ClockHeight -> 
ClockWidth -> 
D -> 
DL -> 
DX -> e
DY -> 
Delay -> 
Dsplit -> 
Event -> N
F -> 
Face -> 
H -> 
HL -> 
HandHeight -> 
HandWidth -> 
HandX -> A
HandY -> 
M -> 
ML -> 
Mouse -> o
Od -> 
Of -> 
Oh -> 
Om -> 
Os -> 
S -> 
SL -> 
Split -> 
StopDelay -> 
TodaysDate -> 
X -> 
Y -> 
currStep -> 
d -> 
dCol -> 
date -> 
day -> 
evnt -> Y
fCol -> 
hCol -> 
hrs -> 
ie -> 
ieDate -> 
ieFace -> 
ieHours -> 
ieMinutes -> 
ieSeconds -> 
m -> 
mCol -> 
mins -> 
mz -> 
mzDate -> W
mzFace -> w
mzHours -> T
mzMinutes -> v
mzSeconds -> V
n -> O
ns -> 
nsDate -> t
nsFace -> R
nsHours -> P
nsMinutes -> Q
nsSeconds -> r
props -> Z
props2 -> z
sCol -> U
scrll -> 
sec -> I
secs -> 
size -> 
step -> 
toID -> 
xmouse -> 
year -> 
ymouse -> 

AntiSpam Policy

The intended use of this Obfuscator is to protect source code that must be downloaded in Web pages because of the poor designs of browsers. Spammers, however, also know how to hide spamvertized destinations in HTML email using JavaScript; obfuscated JavaScript makes this a bit worse. Semantic Designs believes that spam seriously detracts from the value of email because of the useless traffic supported by the receiving victim; worse, spam is sometimes used to send truly disgusting proposals en masse. Semantic Designs will not knowingly offer this tool to spammers. This is probably difficult for us to enforce, and so we apologize to the Internet community in advance for any use that spammers do make of this tool. We remark that other JavaScript obfuscators existed well before ours, so we are not creating a new problem.

For more information: Info@semanticdesigns.com    Follow us at Twitter: @SemanticDesigns

ECMA (Javascript)
Obfuscation Example