473,804 Members | 3,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Any Javascript Obfuscator?

hsriat
1,654 Recognized Expert Top Contributor
Is there any free Javascript Obsfucator available?

Actually I just want the obsfucator to do two things...
1. Remove Comments
2. Rename Functions and Variables
Feb 17 '08
15 4236
hsriat
1,654 Recognized Expert Top Contributor
So, did you manage to cut it down in size?
I didn't do it yet...
Will do after testing.

Will tell you how much file size reduces...
Feb 19 '08 #11
rnd me
427 Recognized Expert Contributor
remember that in javascript, variable names are case-sensitive, so performing global replaces on compressed code could be an easy way to obfuscate names.

if you have a funciton or prototype for doing mulitple replaces, you could feed it a an array of function names, and have it substitute a serial number for each.



continuing above,
Expand|Select|Wrap|Line Numbers
  1.  
  2. String.prototype.substitute = function (r) {
  3.     O = this;
  4.     for (z = 0; z < r.length; z++) {
  5.         tre = new RegExp(r[z][0], "gm");
  6.         O = O.replace(tre, r[z][1]);
  7.     }
  8.     return O;
  9. }
  10.  
  11.  
  12. function serial(dig) {
  13.     var bb = "";
  14.   if(!dig){ dig=5; } 
  15.     for (var q = 0; q < dig; q = q + 1) {
  16.         bb = bb + String.fromCharCode(Math.round(Math.random() * 25 + 65));
  17.     }
  18.     return bb;
  19. }
  20.  
  21. var subs=[
  22.   ["el2",serial()],
  23.   [ "tags", serial()]
  24.    ] //end sub array
  25. alert(BS.toSource().substitute(subs) )
  26.  
  27.  
Feb 19 '08 #12
hsriat
1,654 Recognized Expert Top Contributor
So, did you manage to cut it down in size?
Yeah, quite a lot.

A 32kb well commented JS was reduced to 19 kb.
And a 15 kb, non-commented JS reduced to 14 kb (not too much tho :p)
Feb 25 '08 #13
acoder
16,027 Recognized Expert Moderator MVP
Yeah, quite a lot.

A 32kb well commented JS was reduced to 19 kb.
And a 15 kb, non-commented JS reduced to 14 kb (not too much tho :p)
Every little helps, eh?

If you're using long names for variables, functions, etc. you may want to replace those too.
Feb 25 '08 #14
hsriat
1,654 Recognized Expert Top Contributor
Every little helps, eh?

If you're using long names for variables, functions, etc. you may want to replace those too.
Yeah, I wanted to, but the thing you referred to didn't do that :p

And I don't want to do the find replace thing. B'coz with that, when I would do any change, after doing that with the original (commented) file, I would need to do the whole find-replace thing again.

So I wanted a one-click-solution, so that after making any change, I can get the minified* version quickly and upload it to server again.

* term used by that guy who made that program.
Feb 25 '08 #15
acoder
16,027 Recognized Expert Moderator MVP
Yeah, I wanted to, but the thing you referred to didn't do that :p

And I don't want to do the find replace thing. B'coz with that, when I would do any change, after doing that with the original (commented) file, I would need to do the whole find-replace thing again.

So I wanted a one-click-solution, so that after making any change, I can get the minified* version quickly and upload it to server again.

* term used by that guy who made that program.
Try YUI Compressor, Packer or ShrinkSafe (Dojo).
Feb 25 '08 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2894
by: Smugsboy | last post by:
Anyone. Where can I find a free javascript scrambler/obfuscator, that can be ran from command-line. Is there one that can be used as a frontpage plugin ? Thanks,
2
313
by: Luke Matuszewski | last post by:
Hi, Can anyone point me for some JavaScript Obfuscators ? I know one written by Dean Edwards (but it do not substitute variable names, which a would like to do). B.R. Luke Matuszewski
20
2188
by: korund | last post by:
I want encrypt javascript code in web page, however, browser need fully recognize it.. There any many Javascript Obfuscators in the Net. Is there some good and handy utility(or script) among them that can be recommended?(freeware)
30
4671
by: mistral | last post by:
Neeed good javascript unescape encoder, to protect javascript code. Some advices? Online tool, or ready javascript only. Any opinions about the Javascript Obfuscator: http://www.javascript-source.com/
20
3306
by: twigster | last post by:
Hey everyone, I'm looking for a good way to obfuscate some Javascript code. Does anyone have a good experience or bad experience with a particular software? thanks
4
326
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I protect my javascript code? ----------------------------------------------------------------------- In the main, you can't as your code is distributed in source form and is easily readable. With JScript, there is the Script Encoder (see MSDN), but this is nothing more than obfuscation. Disabling the right mouse button also does nothing to protect...
2
3714
by: Laurent Bugnion [MVP] | last post by:
Hi group, A few years ago, I translated Douglas Crockford's JsMin from C to C#, because we wanted to use this functionality in our build process. JsMin is a code minimizer for JavaScript. It will remove all comments, empty lines, turn tabs into single spaces, etc... The goal is to reduce the size of JavaScript files to the minimum necessary, without modifying the functionality. Additionally to reducing the script's size, JsMin also...
4
2549
by: Peter Michaux | last post by:
Hi, I've uploaded a new version of the JavaScript::Minifier module that was on CPAN. It was a translation of JSMin but I rewrote it so it now handles missing semicolons, + ++ code, and leaves those freaky IE conditional comments in the output. The goal was that if working code is input then working code is output where working == working. Breaking code that works is not such a good idea. :) ...
11
5187
by: =?iso-8859-1?q?Martin_M=FCcke?= | last post by:
Hi, I am looking for a good javascript obfuscator - I found several on the web, but I am looking for one that can also handle javascript in jsp, html and java files - so I need a javascript obfuscator that handles my entire web project. Is there anything like that, preferable as a Eclipse plugin? Thanks,
3
1685
by: crymari2 | last post by:
Hello, I have a need to make my javascript really difficult to study. A lot of people think that this is useless waste of resources, but they are wrong IMHO. I need your recommendation of javascript obfuscator. Googling gives about 5 products. Which of commercial ones do you recommend? The javascript obfuscator by stunnix looks most appealing to me, but I didn't check neither it nor others. Any ideas?
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9588
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10327
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.