-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgost_test.html
61 lines (53 loc) · 2.1 KB
/
gost_test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="RU">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ГОСТ 28147-89 тестовая страница</title>
</head>
<body>
<h1>ГОСТ test page</h1>
<table>
<tr><td>Iterations</td><td><input id='iterations' value='256' type="text"></td></tr>
<tr><td>Max length</td><td><input id='maxLen' value='256' type="text"></td></tr>
<tr><td><input id='button' type='button' value='Start' onclick='return handler()'></td></tr>
</table>
<p id='updNode'>Status: Idle</p>
<div id="mp81ss-scripts">
<script type='text/javascript' src='../src/gost_hash.js'></script>
<script type='text/javascript' src='../src/gost.js'></script>
<script type='text/javascript' src='gost_test.js'></script>
<script type='text/javascript'>
console.log(GostHash.hash(''));
console.log(GostHash.hashCrypto(''));
var handler = function() {
var iterations = document.getElementById('iterations').value;
var maxLen = document.getElementById('maxLen').value;
var re = /^\d+$/;
if (re.exec(iterations) === null) {
alert('Bad iterations number');
}
else if (re.exec(maxLen) === null) {
alert('Bad max len number');
}
else {
var node = document.getElementById('updNode');
if (node.innerText.charAt(node.innerText.length - 1) == '.') {
return false;
}
node.innerText = 'Status: Running...';
setTimeout(function() {
var endTime, startTime = new Date();
gostTest(parseInt(iterations, 10), parseInt(maxLen, 10));
endTime = new Date();
node.innerText = 'Status: DONE in ' +
Number((endTime - startTime) / 1000).toString() +
' seconds';
}, 10);
}
return false;
};
</script>
</div>
</body>
</html>