boost/doc/html/crc/crc_samples.html
2021-10-05 21:37:46 +02:00

180 lines
9.7 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Pre-Defined CRC Samples</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../crc.html" title="Chapter 12. Boost.CRC 1.5">
<link rel="prev" href="acrc_function.html" title="Augmented-CRC Function">
<link rel="next" href="end.html" title="End Matter">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="acrc_function.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../crc.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="end.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="crc.crc_samples"></a><a class="link" href="crc_samples.html" title="Pre-Defined CRC Samples">Pre-Defined CRC Samples</a>
</h2></div></div></div>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">crc_optimal</span><span class="special">&lt;</span><span class="number">16</span><span class="special">,</span> <span class="number">0x8005</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">true</span><span class="special">&gt;</span>
<span class="identifier">crc_16_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">crc_optimal</span><span class="special">&lt;</span><span class="number">16</span><span class="special">,</span> <span class="number">0x1021</span><span class="special">,</span> <span class="number">0xFFFF</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">false</span><span class="special">&gt;</span>
<span class="identifier">crc_ccitt_false_t</span><span class="special">,</span> <span class="identifier">crc_ccitt_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">crc_optimal</span><span class="special">&lt;</span><span class="number">16</span><span class="special">,</span> <span class="number">0x1021</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">true</span><span class="special">&gt;</span> <span class="identifier">crc_ccitt_true_t</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">crc_optimal</span><span class="special">&lt;</span><span class="number">16</span><span class="special">,</span> <span class="number">0x8408</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">true</span><span class="special">&gt;</span> <span class="identifier">crc_xmodem_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">crc_optimal</span><span class="special">&lt;</span><span class="number">16</span><span class="special">,</span> <span class="number">0x1021</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">false</span><span class="special">&gt;</span> <span class="identifier">crc_xmodem_t</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">crc_optimal</span><span class="special">&lt;</span><span class="number">32</span><span class="special">,</span> <span class="number">0x04C11DB7</span><span class="special">,</span> <span class="number">0xFFFFFFFF</span><span class="special">,</span> <span class="number">0xFFFFFFFF</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">true</span><span class="special">&gt;</span>
<span class="identifier">crc_32_type</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
Several sample CRC types are given, representing common CRC algorithms. The
samples have now been checked against the <a href="http://regregex.bbcmicro.net/crc-catalogue.htm" target="_top"><span class="emphasis"><em>Catalogue
of parametrised CRC algorithms</em></span></a>, leading to some new type-aliases
corresponding to the corrected profiles. (Older, incorrect profiles keep their
name for backwards compatibility.) However, this library is primarily concerned
with CRC implementation, and not with determining "good" sets of
CRC parameters.
</p>
<div class="table">
<a name="crc.crc_samples.crc_samples_list"></a><p class="title"><b>Table 12.4. Common CRCs</b></p>
<div class="table-contents"><table class="table" summary="Common CRCs">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Computer Type
</p>
</th>
<th>
<p>
Standard(s)
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">crc_16_type</span></code>
</p>
</td>
<td>
<p>
BISYNCH, ARC, LHA, ZOO
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">crc_ccitt_false_t</span></code>
</p>
</td>
<td>
<p>
Commonly misidentified as the standard by CCITT
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">crc_ccitt_type</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="identifier">crc_ccitt_false_t</span></code>
(I made the same mistake.)
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">crc_ccitt_true_t</span></code>
</p>
</td>
<td>
<p>
Designated by CCITT (Comité Consultatif International Télégraphique
et Téléphonique), KERMIT
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">crc_xmodem_type</span></code>
</p>
</td>
<td>
<p>
A mistake I didn't catch in defining <code class="computeroutput"><span class="identifier">crc_xmodem_t</span></code>.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">crc_xmodem_t</span></code>
</p>
</td>
<td>
<p>
XMODEM, ZMODEM, ACORN
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">crc_32_type</span></code>
</p>
</td>
<td>
<p>
ADCCP, PKZip, libPNG, AUTODIN II, Ethernet, FDDI
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2001, 2003, 2012 Daryle Walker<p>
Distributed under the Boost Software License, Version 1.0. (See the accompanying
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="acrc_function.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../crc.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="end.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>