Skip to content


JS Distributed Computing

A few months, i attempted something called “Distributed Computing”. There are many distributed computing projects. Some big ones are Folding@Home, SETI@Home, and everything else. These have a relatively small user base. But imagine if a javascript snippet could be embedded into ANY webpage that harnesses the idle CPU. Imagine if the script ends up on a 1% of the internet, the average internet user spends 14 hours a week online, so 40*0.01 is .14 hours (8.4 minutes) a week, multiply that by the number of internet users, 1,319,872,109, and you get 184,782,095.3 a WEEK, multiply that by 52, and get 9,608,668,954. That’s 9.6 BILLION hours of computing time you get in a YEAR.

The chances of anyone noticing the script running is slim. Its not nearly as efficient as those other computing platforms. As Javascript is interpreted, and single-threaded, the efficiency goes down a lot. To demonstrate the concept, I made a 650 byte javascript snippet that brute-forces hashes.

var _d={eh:”http://antimatter15.110mb.com/misc/distcrack/work.php?”,iv:150,f:hex_md5,
z:150,n:0,v:”f”,s:function(h,e,d){document.body.removeChild(_d.q);_d.d=d.split(“”);_d.d.push(“”);_d.h=h;_d.e=e;_d.y=_d.w()-_d.z
_d.u()},w:function(){return(new Date()).getTime()},u:function(){var x=_d.w(),e=_d.e+_d.d[_d.n],i=0;if(x-_d.y-_d.z<9)_d.z=_d.iv
else _d.z=x-_d.y; if(_d.n<_d.d.length){for(;i<_d.d.length;i++){if(_d.f(e+_d.d[i])==_d.h){_d.v=e+_d.d[i];_d.b()}}
_d.n++;_d.y=_d.w();_d.x=setTimeout(_d.u,_d.z)}else _d.b()},g:function(u){_d.q=document.createElement(“script”)
_d.q.src=_d.eh+u;document.body.appendChild(_d.q)},b:function(){_d.cs()
_d.g(“e=”+_d.e+”&h=”+_d.h+”&r=”+_d.v)},cs:function(){clearTimeout(_d.x);_d.n=0}}


In this page, it is an Opt-in service, where you just press this link to enable it. The chances are, that you don’t really realize anything happening. Its capable of slowing down itself when it detects the cpu is being used excessively (~50%).

If you want to know what its doing, press this link. and if you want to stop it, press this link

Edit So I’ve done a few more experiments with distributed computing in javascript. I’ve tried to find palindromes, to calculate pi (in fact, several times)

Posted in Javascript Distributed Computing.


5 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. aproche says

    Hello, this is exactly what I was looking for.
    Did you contact anyone from Boinc (SETI@home etc…) and tell them about your script ?
    It could increase the performance by a thousandfold at least.
    Boinc average being 2.6 PFLOPS at the moment.

  2. admin says

    That’s the idea, but BOINC is much more complicated.

  3. witek says

    Nothing new. How about including this into facebook or google? :) And something more usefull than hash collision would be useull. Still need to be small enaugh to be unnoticed.

  4. admin says

    It is pretty small, though yeah, hash collision isn’t useful at all. Would be great if it was on facebook or google though :)

  5. Jon says

    Interesting post, thanks. I’ve been thinking about this problem also, and wonder if a site for the purposes of rating/reviewing compute snippets would help encourage take-up (presently one issue is the security problems associated with running JavaScript from anonymous sources). In general, I think this is a hugely under-explored topic, and wonder what the blockers are to getting more activity around it?

    Aside: if you’re not already aware, the links to your demo are broken. When starting the demo, I get “NetworkError: 504 Gateway Time-out – http://antimatter15.110mb.com/misc/distcrack/work.php?undefined“, and when getting stats, I get “TypeError: _d.d is undefined”.



Some HTML is OK

or, reply to this post via trackback.