# Can someone explain this javascript to me?

Hello, can someone explain how the value 8123 gets produced from this code?

``````eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('d=7;c=4;b=5;a=2;e=3;f=1;g=9;h=6;i=0;j=8;',20,20,'||||||||||t|p|u|x|y|o|||w|q'.split('|'),0,{}))
``````

document.write(+q+o+t+y)  produces 8123
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Microsoft Dynamics CRM ConsultantCommented:
Hi,

Try http://jsbeautifier.org and paste your js to beautify. It will generate following result:

x = 7;
u = 4;
p = 5;
t = 2;
y = 3;
o = 1;
g = 9;
h = 6;
w = 0;
q = 8;

Seems, this is just encrypted js so no one gets what is being cooked for a functionality.

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Microsoft Dynamics CRM ConsultantCommented:
This seems more like a key to some encryption algorithm. when sorted it became - wotyuphxqg which doesn't make any sense.
Author Commented:
yea it appears jsbeautifier produced the correct result.  i'm trying to figure out how to execute that javascript function either from vb.net or php.  basically i'm pulling that function from a remote site and i'd like to execute it from within a program of my own.  i don't want to have to use my web browser to execute the function....need to do it from within a program.
Microsoft Dynamics CRM ConsultantCommented:
I'm not sure about how would you able to do that in vb.net... I think php will be able to execute it within browser.
Author Commented:
yea i can get php to echo the results out to the browser...just wish there was a way for me to actually get the values without using a browser
Owner (Aidellio)Commented:
I'll take a look for you as it sounds like you just want this converted to a function you can use on php or whatever
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.