crc8.h 663 B

123456789101112131415161718192021222324
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. //
  5. // Crc8 utility functions.
  6. #ifndef RLZ_LIB_CRC8_H_
  7. #define RLZ_LIB_CRC8_H_
  8. namespace rlz_lib {
  9. // CRC-8 methods:
  10. class Crc8 {
  11. public:
  12. static bool Generate(const unsigned char* data,
  13. int length,
  14. unsigned char* check_sum);
  15. static bool Verify(const unsigned char* data,
  16. int length,
  17. unsigned char checksum,
  18. bool * matches);
  19. };
  20. } // namespace rlz_lib
  21. #endif // RLZ_LIB_CRC8_H_