项目作者: sablinkv

项目描述 :
Cyclic redundancy check algorithm.
高级语言: C++
项目地址: git://github.com/sablinkv/CRC.git
创建时间: 2020-08-02T17:51:18Z
项目社区:https://github.com/sablinkv/CRC

开源协议:MIT License

下载


CRC

Cyclic redundancy check algorithm.

Building

The following commands build the project.

  1. mkdir build
  2. cd build
  3. cmake ..
  4. cmake --build .

Development

The following command builds the project and
runs the tests.

  1. cmake ..
  2. cmake --build . --config Degub/Release
  3. ctest -C Debug/Release

Usage

  1. #include <crc.hpp>
  2. #include <iostream>
  3. #include <string>
  4. #include <vector>
  5. int main() {
  6. const std::string Text("Some string 1234567890");
  7. CRC32::DEFAULT crc32;
  8. auto result_crc32 = crc32(Text.begin(), Text.end());
  9. const std::vector<std::uint8_t> ByteArray({ 0x10, 0x38, 0x24, 0x13, 0x75, 0x63, 0x1, 0x0, 0x58 });
  10. CRC16::MODBUS crc16;
  11. auto result_crc16 = crc16(ByteArray.data(), ByteArray.size());
  12. return 0;
  13. }