Compute the CRC32 primitive on one byte.
178374
def _crc32(self, ch, crc):
        """"""
        return ((crc >> 8) & 0xffffff) ^ self.crctable[(crc ^ ord(ch)) & 0xff]
299525
function lockCrc(inputStr){

		res = 0xff;
		inputHex = new Buffer(inputStr,'hex');

		//start from the second byte 
		for (i = 1; i<= inputHex.length; i++) {
			res = res ^ inputHex[i];
		}
		//add padding
		reshex = (res+0x100).toString(16).substr(-2);
//		console.log(reshex);

		return(inputStr+reshex);
}
1180231
public static int crc16(byte[] bytes, int off, int len) {

        int crc = 0x0000;
        int end = off + len;

        for (int i = off; i < end; i++) {
            crc = doCrc(bytes[i], crc);
        }

        return crc & 0xFFFF;
    }
1156636
function(buf, crc) {

      var c = (typeof(crc) == "undefined" ? 0 : crc) ^ 0xffffffff;
      var bArray  = typeof buf !== "string";
      var n;

      if (bArray) {
        for (n = 0; n < buf.length; n++) {
          c = SAP_CRC32_TABLE[(c ^ buf[n]) & 0xff] ^ (c >>> 8);
        }
      } else {
        for (n = 0; n < buf.length; n++) {
          c = SAP_CRC32_TABLE[(c ^ buf.charCodeAt(n)) & 0xff] ^ (c >>> 8);
        }
      }

      return c ^ 0xffffffff;
    }
641448
def crc16_nojit(s, crc=0):
  """"""
  for ch in bytearray(s):  # bytearray's elements are integers in both python 2 and 3
    crc = ((crc << 8) & 0xFFFF) ^ _crc16_tab[((crc >> 8) & 0xFF) ^ (ch & 0xFF)]
    crc &= 0xFFFF
  return crc
583239
public static byte calc(byte[] data, int len) {
        byte crc = 0;

        for (int i = 0; i < len; i++)
            crc = CRC8_TABLE[(crc ^ data[i]) & 0xff];

        return crc;
    }
874350
def crc16(data):
    
    m_crc = 0xffff
    for this in data:
        m_crc ^= ord(this)
        for _ in range(8):
            j = m_crc & 1
            m_crc >>= 1
            if j:
                m_crc ^= 0x8408
    return m_crc
1235534
def crc8(data):
        
        crc = 0

        for byte in data:
            crc ^= byte
            for _ in range(8):
                if crc & 0x01:
                    crc = (crc >> 1) ^ 0x8C
                else:
                    crc >>= 1
                crc &= 0xFF
        return crc
398885
def compute_checksum(filename, max_length=2**20):
    

    fid = open(filename, 'rb') # Use binary for portability
    crcval = safe_crc(fid.read(max_length))
    fid.close()

    return crcval
1042600
def crc16jit(buf, offset, crc, length):
  """"""
  for index in range(offset, offset + length):
    data = buf[index]
    lookup = crc16_tab[((nb.u2(crc) >> 8) & nb.u2(0xFF)) ^ (data & nb.u2(0xFF))]
    crc = ((nb.u2(crc) << nb.u2(8)) & nb.u2(0xFFFF)) ^ lookup
    crc = nb.u2(crc) & nb.u2(0xFFFF)
  return crc
390733
static int calculateChecksum(ByteBuf data, int offset, int length) {
        Crc32c crc32 = new Crc32c();
        try {
            crc32.update(data, offset, length);
            return maskChecksum((int) crc32.getValue());
        } finally {
            crc32.reset();
        }
    }
161855
def crc32File(filename, skip=0):
    
    with open(filename, 'rb') as stream:
        discard = stream.read(skip)
        return zlib.crc32(stream.read()) & 0xffffffff
990554
def file_crc32(filename, chunksize=_CHUNKSIZE):
    

    check = 0
    with open(filename, 'rb') as fd:
        for data in iter(lambda: fd.read(chunksize), ""):
            check = crc32(data, check)
    return check
1114529
public static long generate(long crc, long value)
  {
    crc = next(crc, (byte) (value >> 56));
    crc = next(crc, (byte) (value >> 48));
    crc = next(crc, (byte) (value >> 40));
    crc = next(crc, (byte) (value >> 32));
    crc = next(crc, (byte) (value >> 24));
    crc = next(crc, (byte) (value >> 16));
    crc = next(crc, (byte) (value >> 8));
    crc = next(crc, (byte) (value >> 0));

    return crc;
  }
197476
def crc16(frame):
    
    crc = 0xFFFF
    for index, item in enumerate(bytearray(frame)):
        next_byte = item
        crc ^= next_byte
        for i in range(8):
            lsb = crc & 1
            crc >>= 1
            if lsb:
                crc ^= 0xA001
    return crc
1179181
def _py2_crc16(value):
    
    crc = 0
    for byte in value:
        crc = ((crc << 8) & 0xffff) ^ \
              _CRC16_LOOKUP[((crc >> 8) ^ ord(byte)) & 0xff]
    return crc
1198457
def _crc16_checksum(bytes):
    
    crc = 0x0000
    polynomial = 0x1021

    for byte in bytes:
        for i in range(8):
            bit = (byte >> (7 - i) & 1) == 1
            c15 = (crc >> 15 & 1) == 1
            crc <<= 1
            if c15 ^ bit:
                crc ^= polynomial

    return crc & 0xFFFF