forked from PKAstro/Gemini-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCksum.html
101 lines (73 loc) · 3.7 KB
/
Cksum.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Pauls Checksum Calculator</title>
<head profile="http://www.w3.org/2005/10/profile">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" href="ajxmenu.css" type="text/css">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="en-us" http-equiv="Content-Language" />
<link href="gemini-2.css" rel="stylesheet" title = "light" type="text/css">
<link href="gemini-2-dark.css" rel="stylesheet" title = "dark" type="text/css">
<script src="style_switcher.js"></script>
<link href="theme-selector.css" rel="stylesheet" type="text/css">
<script src="w3data.js"></script></head>
<body onload="set_style_from_cookie(); document.getElementById('inp').focus();">
<div w3-include-html="header.html" ></div>
<div class="AJXMenueDFaTFD" w3-include-html="navigation.html"></div><script>w3IncludeHTML();</script>
<script language="javascript" type="text/javascript">
// <![CDATA[
function DoIt_onclick() {
var input = document.getElementById('inp');
var bytes = input.value;
var b = 0;
bytesChecksum = 0;
bytesCount = bytes.length;
for (i = 0; i < bytesCount; i++) {
b = bytes.charCodeAt(i);
bytesChecksum = (bytesChecksum ^ b) & 0xFF;
}
var c1 = (bytesChecksum & 0x7f) + 0x40;
var c2 = (bytesChecksum & 0xff) + 0x40;
var output = document.getElementById('output');
var output2 = document.getElementById('output2');
var outputa = document.getElementById('outputa');
var output2a = document.getElementById('output2a');
output.value = String.fromCharCode(c1) + " [0x" + c1.toString(16) + "]";
output2.value = String.fromCharCode(c2) + " [0x" + c2.toString(16) + "]";
outputa.value = bytes + String.fromCharCode(c1) + "#";
output2a.value = bytes + String.fromCharCode(c2) + "#";
}
function KeyDownHandler(event) {
if (event.keyCode == 13) {
event.returnValue = false;
event.cancel = true;
DoIt_onclick();
}
}
// ]]>
</script>
<table align="center" style="width: 900px">
<tr>
<td class="style6wborder">
<p style="height: 25px; font-size: x-large;" class="style1">
Gemini Native Command Checksum Calculator</p>
<p style="height: 10px; " class="style2">
by Paul Kanevsky, April 2012</p>
<p style="height: 10px; font-size: x-small;">
</p>
<p style="height: 39px">
<input id="DoIt" title="Calculate" value="Calculate" onclick="return DoIt_onclick()" type="button">
<input id="inp" onkeydown="KeyDownHandler(event)" type="text"> for example <130:</p>
<p style="height: 39px">
Checksum Gemini-1:
<input id="output" readonly="readonly" type="text"><input id="outputa" readonly="readonly" style="margin-left: 30px;" type="text"></p>
<p style="height: 39px">
Checksum Gemini-2:
<input id="output2" readonly="readonly" type="text"><input id="output2a" readonly="readonly" style="margin-left: 30px;" type="text"></p>
</td></tr></table>
<link rel="stylesheet" href="ajxmenu_bottom.css" type="text/css">
<div w3-include-html="footer.html" ></div>
</body>
</html>