Boost C++ 库

……世界上最受推崇且设计最专业的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu,《C++ 编码规范

参考 - Boost C++ 函数库
PrevUpHomeNext

参考

头文件 <boost/crc.hpp>

一组函数模板和类模板,用于计算各种形式的循环冗余校验(CRCs)。

Daryle Walker

1.5

Boost 软件许可证,版本 1.0

包含各种 CRC 计算函数、函数对象类型和封装策略类型的声明(以及定义)。

[Warning] 警告

示例 CRC 计算器类型刚刚根据 参数化 CRC 算法目录 进行检查。对于我误解的标准,添加了新的类型别名。不过,为了向后兼容,错误的 typedef 仍然保留。

[Note] 注意

文中提及 Rocksoft™ Model CRC Algorithm,该算法在《A Painless Guide to CRC Error Detection Algorithms》中描述,可通过 Ross Williams 的 “CRC: A Paper On CRCs” 链接获取。在其他文档块中将简称为 “RMCA”。

BOOST_CRC_PARM_TYPE
BOOST_CRC_OPTIMAL_NAME
namespace boost {
  template<std::size_t Bits> class crc_basic;
  template<std::size_t Bits, unspecified TruncPoly, unspecified InitRem, 
           unspecified 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, unspecified TruncPoly, unspecified InitRem, 
           unspecified FinalXor, bool ReflectIn, bool ReflectRem> 
    unspecified crc(void const *, std::size_t);
  template<std::size_t Bits, unspecified TruncPoly> 
    unspecified augmented_crc(void const *, std::size_t, unspecified = 0u);
}

PrevUpHomeNext