Browse Subversion Repository
Contents of /trunk/doc/en/html/macro/command/crc32.html
Parent Directory
| Revision Log
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
3 |
<html> |
4 |
<head> |
5 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
6 |
<title>crc32</title> |
7 |
<meta http-equiv="Content-Style-Type" content="text/css"> |
8 |
<link rel="stylesheet" href="../../style.css" type="text/css"> |
9 |
</head> |
10 |
|
11 |
<body> |
12 |
|
13 |
|
14 |
<h1>crc32</h1> |
15 |
|
16 |
<p> |
17 |
Calculates the CRC-32 of a string. |
18 |
</p> |
19 |
|
20 |
<pre class="macro-syntax"> |
21 |
crc32 <string> |
22 |
</pre> |
23 |
|
24 |
<h2>Remarks</h2> |
25 |
|
26 |
<p> |
27 |
This macro function calculates the CRC(Cyclic Redundancy Checking) of a string. The polynomial expression(right rotation) is as follows: |
28 |
<br><br> |
29 |
|
30 |
100000100110000010001110110110111 (x<sup>32</sup>+x<sup>26</sup>+x<sup>23</sup>+x<sup>22</sup>+x<sup>16</sup>+x<sup>12</sup>+x<sup>11</sup>+x<sup>10</sup>+x<sup>8</sup>+x<sup>7</sup>+x<sup>5</sup>+x<sup>4</sup>+x<sup>2</sup>+x<sup>1</sup>+x<sup>0</sup>) |
31 |
<br><br> |
32 |
|
33 |
The calculated value stores the system variable "result" as mathematival value. |
34 |
</p> |
35 |
|
36 |
<h2>Example</h2> |
37 |
|
38 |
<pre class="macro-example"> |
39 |
<code> |
40 |
str = 'this is a test string to be CRC32ed' |
41 |
crc32 str |
42 |
|
43 |
; Display CRC32 result asHEX |
44 |
sprintf '0x%08X' result |
45 |
messagebox inputstr 'CRC32 = ' |
46 |
</code></pre> |
47 |
|
48 |
</body> |
49 |
</html> |
|