lib/crc32.js
function crc32( buffer, seed, table ) {

  var crc = seed ^ -1
  var length = buffer.length - 15
  var TABLE = table || crc32.TABLE.DEFAULT
  var i = 0

  while( i < length ) {
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
  }

  length = length + 15

  while( i < length )
    crc = ( crc >>> 8 ) ^ TABLE[ ( crc ^ buffer[ i++ ] ) & 0xFF ]

  return crc ^ -1

}
function crc32( buffer, seed, table ) {

  var crc = seed ^ -1
  var length = buffer.length - 15
  var TABLE = table || crc32.TABLE.DEFAULT
  var i = 0

  while( i < length ) {
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
    crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ]
  }

  length = length + 15

  while( i < length )
    crc = ( crc >>> 8 ) ^ TABLE[ ( crc ^ buffer[ i++ ] ) & 0xFF ]

  return crc ^ -1

}
function crc32 ( buffer , seed , table ) { var crc = seed ^ - 1 var length = buffer . length - 15 var TABLE = table || crc32 . TABLE . DEFAULT var i = 0 while ( i < length ) { crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE [ 0xFF & ( crc ^ buffer [ i ++ ] ) ] } length = length + 15 while ( i < length ) crc = ( crc >>> 8 ) ^ TABLE [ ( crc ^ buffer [ i ++ ] ) & 0xFF ] return crc ^ - 1 }
Calculate the CRC32 checksum of a given buffer
@param {Buffer} buffer
@param {Number} [seed=0]
@param {Int32Array} [table=crc32.TABLE.DEFAULT]
@returns {Number} checksum
Calculate the CRC32 checksum of a given buffer