Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the custom function(p,a,c,k,e,d) used for?

Tags:

javascript

People also ask

What is JavaScript custom function?

Custom functions enable developers to add new functions to Excel by defining those functions in JavaScript as part of an add-in. Users within Excel can access custom functions just as they would any native function in Excel, such as SUM() . Note that Excel custom functions are available on the following platforms.

What is script function?

Functions differ from key-bound scripts in that they can return information after they finish executing. A function can also accept data from the calling script or function. The data passed to a function is called a parameter and the data returned to the calling script or function is called a return.

What is a packer JavaScript?

A "packer" is the same as a "minifier". The most common tool that calls itself a "packer" is http://dean.edwards.name/packer/ which gives the option (turned off by default) to base62 encode. Base62 encoding is probably a bad idea: https://stackoverflow.com/a/1351624/24267. Follow this answer to receive notifications.


So if you use http://matthewfl.com/unPacker.html as I posted in the comments, it "unpacks" the code into this:

(function()
    {
    var b="some sample packed code";
    function something(a)
        {
        alert(a)
    }
    something(b)
}
)();

It doesn't seem to be malicious. For a soft argument on why you would use this, see javascript packer versus minifier:

Packed is smaller but is slower.

And even harder to debug.

Most of the well known frameworks and plugins are only minified.


Packer does more then just rename vars and arguments, it actually maps the source code using Base62 which then must be rebuilt on the client side via eval() in order to be usable.

Side stepping the eval() is evil issues here, this can also create a large amount of overhead on the client during page load when you start packing larger JS libraries, like jQuery. This why only doing minify on your production JS is recommend, since if you have enough code to need to do packing or minify, you have enough code to make eval() choke the client during page load.


Minifier only removes unnecessary things like white space characters where as a Packer goes one step further and does whatever it can do to minimize the size of javascript. For example it renames variables to smaller names.

It's a function which decompresses compressed/obfuscated javascript code. Many JS libraries and scripts make use of it.

There are online tools where you can pack and unpack code via the browser, which use the function.


As I have seen that eval(function(p,a,c,k,e,d){}) is used in http://www.indiabix.com which uses it for hiding whole contents when user get download the page and open it . Maybe that is the inner workings of the particular code.