Skip to content

Commit cf5babb

Browse files
committed
Demo: add encoding, improve appearance
1 parent 9acee69 commit cf5babb

File tree

1 file changed

+48
-12
lines changed

1 file changed

+48
-12
lines changed

index.html

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@
1111
}
1212

1313
#out {
14-
padding: 10px 0;
14+
margin-top: 10px;
15+
padding: 10px 5px;
16+
color: #444;
17+
line-height: 1.5;
18+
}
19+
20+
#out small {
21+
padding: 5px;
22+
background-color: #eee;
1523
}
1624

1725
#N {
@@ -24,15 +32,42 @@
2432
<body>
2533
<h1><a href="https://github.com/dchest/scrypt-async-js">scrypt-async-js</a> demo</h1>
2634
<form onsubmit="calculate(); return false">
27-
<p>Password: <input name="password" type="text" value="password" size="32"></p>
28-
<p>Salt: <input name="salt" type="text" value="salt" size="32"></p>
29-
<p>interruptStep: <input name="interruptStep" type="text" value="0" size="8"></p>
30-
<p>logN: <input name="logN" type="text" value="11" size="4" onkeypress="updateN()"
31-
onchange="updateN()" onkeyup="updateN()"
32-
onblur="updateN()"><span id="N"></p>
33-
<p>r: <input name="r" type="text" value="8" size="4"></p>
34-
<p>p: <input name="p" type="text" value="1" size="4"></p>
35-
<input type="submit" name="btn" value="Calculate" />
35+
<p>
36+
<label for="password">Password:</label>
37+
<input id="password" name="password" type="text" value="password" size="32">
38+
</p>
39+
<p>
40+
<label for="salt">Salt:</label>
41+
<input id="salt" name="salt" type="text" value="salt" size="32">
42+
</p>
43+
<p>
44+
<label for="interruptStep">interruptStep:</label>
45+
<input id="interruptStep" name="interruptStep" type="text" value="0" size="8">
46+
</p>
47+
<p>
48+
<label for="logN">logN:</label>
49+
<input id="logN" name="logN" type="text" value="11" size="4"
50+
onkeypress="updateN()" onkeyup="updateN()"
51+
onblur="updateN()" onchange="updateN()" >
52+
<span id="N">
53+
</p>
54+
<p>
55+
<label for="r">r:</label>
56+
<input id="r" name="r" type="text" value="8" size="4">
57+
</p>
58+
<p>
59+
<label for="p">p:</label>
60+
<input id="p" name="p" type="text" value="1" size="4">
61+
</p>
62+
<p>
63+
<label for="encoding">Encoding:</label>
64+
<select id="encoding" name="encoding">
65+
<option value="hex" selected>hex</option>
66+
<option value="base64">base64</option>
67+
<option value="binary">binary</option>
68+
</select>
69+
</p>
70+
<input type="submit" name="btn" value="Calculate" />
3671
</form>
3772
<div id="out"></div>
3873

@@ -57,6 +92,7 @@ <h1><a href="https://github.com/dchest/scrypt-async-js">scrypt-async-js</a> demo
5792
var logN = f.logN.value;
5893
var r = f.r.value;
5994
var p = f.p.value;
95+
var encoding = f.encoding.value;
6096

6197
btn.disabled = true;
6298
btn.value = 'Wait...';
@@ -70,11 +106,11 @@ <h1><a href="https://github.com/dchest/scrypt-async-js">scrypt-async-js</a> demo
70106
p: p,
71107
dkLen: 32,
72108
interruptStep: interruptStep,
73-
encoding: 'hex'
109+
encoding: encoding
74110
},
75111
function(res) {
76112
var t2 = ((new Date()).getTime()-t1);
77-
out.innerHTML = 'scrypt: <b>'+t2+' ms</b> ' + res + '';
113+
out.innerHTML = 'Time: <b>'+t2+' ms</b><br>Result: <small>' + res + '</small>';
78114
btn.disabled = false;
79115
btn.value = 'Calculate';
80116
});

0 commit comments

Comments
 (0)