--- /dev/null
+<html>
+<head>
+<script type="text/javascript">
+var prime=257;
+function e(e,t){return '<'+e+'>'+t+'</'+e+'>';} // html element with content t
+function v(i){return document.getElementById(i).value;} // value of element with id
+function h(i,t){document.getElementById(i).innerHTML=t};
+
+function s2n(s){
+ var i,j,coef,n,x,sum;
+ var shares = v('shares');
+ var treshold = v('treshold');
+ var results = [];
+ var th=e('th','char');;
+ var ns=e('th','ascii');;
+
+ for (i=0; i<s.length;i++) {
+ n=s.charCodeAt(i);
+ th+=e('td',s[i]);
+ ns+=e('td',n);
+
+ coef=[n];
+ for (j=1; j<treshold;j++) coef[j]=Math.floor(Math.random()*prime);
+
+ results[i]=[];
+
+ for (sum=0,x=0; x<shares; x++){
+ for (j in coef) sum+=coef[j]*Math.pow(x+1,j);
+ results[i][x]=sum%prime;
+ }
+ }
+
+ var code=e('tr',th)+e('tr',ns);
+ for (j=0;j<shares;j++){
+ var line=e('th','share '+(j+1));
+ for (i=0;i<s.length;i++){
+ line+=e('td',results[i][j]);
+ }
+ code+=e('tr',line);
+ }
+ h('tab',code);
+ return n;
+}
+</script>
+</head>
+<body>
+Shares: <input id="shares" value="5"></br>
+Min: <input id="treshold" value="3"></br>
+Secret: <input name="secret" onkeyup="s2n(this.value);">
+<table id="tab">
+</table>
+</body>
+</html>
\ No newline at end of file