3 <style type="text/css">
7 border-width: 0 0 0 1px;
11 <script type="text/javascript">
13 function e(e,t){return '<'+e+'>'+t+'</'+e+'>';} // html element with content t
14 function v(i){return document.getElementById(i).value;} // value of element with id
15 function h(i,t){document.getElementById(i).innerHTML=t};
19 var shares = v('shares');
20 var treshold = v('treshold');
22 var th=e('th','char');;
23 var ns=e('th','ascii');;
25 for (i=0; i<s.length;i++) {
31 for (j=1; j<treshold;j++) coef[j]=Math.floor(Math.random()*prime);
35 for (sum=0,x=0; x<shares; x++){
36 for (j in coef) sum+=coef[j]*Math.pow(x+1,j);
37 results[i][x]=sum%prime;
41 var code=e('tr',th)+e('tr',ns);
42 for (j=0;j<shares;j++){
43 var line=e('th','share '+(j+1));
44 for (i=0;i<s.length;i++){
45 line+=e('td',results[i][j]);
55 Shares: <input id="shares" value="5"></br>
56 Min: <input id="treshold" value="3"></br>
57 Secret: <input name="secret" onkeyup="s2n(this.value);">