crc8.h 548 B

123456789101112131415161718192021222324
  1. /*
  2. * Copyright (c) 2013 Google, Inc
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef __linux_crc8_h
  7. #define __linux_crc8_h
  8. /**
  9. * crc8() - Calculate and return CRC-8 of the data
  10. *
  11. * This uses an x^8 + x^2 + x + 1 polynomial. A table-based algorithm would
  12. * be faster, but for only a few bytes it isn't worth the code size
  13. *
  14. * @crc_start: CRC8 start value
  15. * @vptr: Buffer to checksum
  16. * @len: Length of buffer in bytes
  17. * @return CRC8 checksum
  18. */
  19. unsigned int crc8(unsigned int crc_start, const unsigned char *vptr, int len);
  20. #endif