3 <script type="text/javascript">
5 function e(e,t){return '<'+e+'>'+t+'</'+e+'>';} // html element with content t
6 function v(i){return document.getElementById(i).value;} // value of element with id
7 function h(i,t){document.getElementById(i).innerHTML=t};
11 var shares = v('shares');
12 var treshold = v('treshold');
14 var th=e('th','char');;
15 var ns=e('th','ascii');;
17 for (i=0; i<s.length;i++) {
23 for (j=1; j<treshold;j++) coef[j]=Math.floor(Math.random()*prime);
27 for (sum=0,x=0; x<shares; x++){
28 for (j in coef) sum+=coef[j]*Math.pow(x+1,j);
29 results[i][x]=sum%prime;
33 var code=e('tr',th)+e('tr',ns);
34 for (j=0;j<shares;j++){
35 var line=e('th','share '+(j+1));
36 for (i=0;i<s.length;i++){
37 line+=e('td',results[i][j]);
47 Shares: <input id="shares" value="5"></br>
48 Min: <input id="treshold" value="3"></br>
49 Secret: <input name="secret" onkeyup="s2n(this.value);">