NSData+CRC.h 473 B

1234567891011121314151617181920212223
  1. //
  2. // NSData+CRC.h
  3. // CommonLibrary
  4. //
  5. // Created by Ken on 3/25/14.
  6. // Copyright (c) 2014 Alexi. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #define DEFAULT_POLYNOMIAL 0xEDB88320L
  10. #define DEFAULT_SEED 0xFFFFFFFFL
  11. @interface NSData (CRC)
  12. - (uint8_t)crc8;
  13. - (uint32_t)crc32;
  14. - (uint32_t)crc32WithSeed:(uint32_t)seed;
  15. - (uint32_t)crc32UsingPolynomial:(uint32_t)poly;
  16. - (uint32_t)crc32WithSeed:(uint32_t)seed usingPolynomial:(uint32_t)poly;
  17. @end