Skip to content

Latest commit

 

History

History
 
 

CRC

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

CRC

A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data.

Informations

  • First published - 1961
  • Series - CRC-(number)
  • Digest sizes - 8, 16, 32, 64 bits
  • Structure - cyclic codes

Authors

W. Wesley Peterson

Implementations

  • crc16.c
  • crc32.c

Materials

Pseudocode

Since a CRC is fundamentally bit-oriented, the order that you assign to bits in bytes matters. You can do it big-endian.

function crc(bit array bitString[1..len], int polynomial) {
    shiftRegister := initial value // commonly all 0 bits or all 1 bits
    for i from 1 to len {
        if most significant bit of shiftRegister xor bitString[i] = 1 {
            shiftRegister := (shiftRegister left shift 1) xor polynomial
        } else {
            shiftRegister := (shiftRegister left shift 1)
        }
    }
    return shiftRegister
}