Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Reference

Header <boost/crc.hpp>

Header <boost/crc.hpp>

A collection of function templates and class templates that compute various forms of Cyclic Redundancy Codes (CRCs).

Daryle Walker

1.5

Boost Software License, version 1.0

Contains the declarations (and definitions) of various kinds of CRC computation functions, function object types, and encapsulated policy types.

[Warning] Warning

The sample CRC-computer types were just checked against the Catalogue of parametrised CRC algorithms. New type aliases were added where I got a standard wrong. However, the mistaken typedefs are still there for backwards compatibility.

[Note] Note

There are references to the Rocksoft™ Model CRC Algorithm, as described within "A Painless Guide to CRC Error Detection Algorithms," linked from "CRC: A Paper On CRCs" by Ross Williams. It will be abbreviated "RMCA" in other documentation blocks.


BOOST_CRC_PARM_TYPE
BOOST_CRC_OPTIMAL_NAME
namespace boost {
  template<std::size_t Bits> class crc_basic;
  template<std::size_t Bits, typename ::boost::uint_t< Bits >::fast TruncPoly, 
           typename ::boost::uint_t< Bits >::fast InitRem, 
           typename ::boost::uint_t< Bits >::fast FinalXor, bool ReflectIn, 
           bool ReflectRem> 
    class crc_optimal;

  typedef crc_optimal< 16, 0x8005, 0, 0, true, true > crc_16_type;  // Computation type for ARC|CRC-16|CRC-IBM|CRC-16/ARC|CRC-16/LHA standard. 
  typedef crc_optimal< 16, 0x1021, 0xFFFF, 0, false, false > crc_ccitt_false_t;  // Computation type for CRC-16/CCITT-FALSE standard. 
  typedef crc_ccitt_false_t crc_ccitt_type;  // Computation type for the CRC mistakenly called the CCITT standard. 
  typedef crc_optimal< 16, 0x1021, 0, 0, true, true > crc_ccitt_true_t;
  typedef crc_optimal< 16, 0x8408, 0, 0, true, true > crc_xmodem_type;
  typedef crc_optimal< 16, 0x1021, 0, 0, false, false > crc_xmodem_t;  // Computation type for the actual XMODEM|ZMODEM|CRC-16/ACORN standard. 
  typedef crc_optimal< 32, 0x04C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, true, true > crc_32_type;  // Computation type for CRC-32|CRC-32/ADCCP|PKZIP standard. 
  template<std::size_t Bits, typename ::boost::uint_t< Bits >::fast TruncPoly, 
           typename ::boost::uint_t< Bits >::fast InitRem, 
           typename ::boost::uint_t< Bits >::fast FinalXor, bool ReflectIn, 
           bool ReflectRem> 
    uint_t< Bits >::fast crc(void const *, std::size_t);
  template<std::size_t Bits, typename ::boost::uint_t< Bits >::fast TruncPoly> 
    uint_t< Bits >::fast 
    augmented_crc(void const *, std::size_t, 
                  typename uint_t< Bits >::fast = 0u);
}

PrevUpHomeNext