A simple implementation of crc for communication with an SD card via the spi protocol.
According to the Physical Layer Simplified Specification (Version 9.00, 4.7.2 - command format and 7.2.3 - data read), the CRC occupies the lower six bits of the last byte. In the case of CRC7, the remaining (highest) 5 bytes of data are protected. If CRC16 is used, then all data before the 2 CRC (low-order) bytes is protected. Examples and checks of calculations are present in the main file.
Examples and checks of calculations are present in the main file.