lib/bitString.js
function checksum (bits, size) {
  if (bits == null || !isValid(bits)) throw new Error('bitString#checksum: Need valid bits');
  if (size == null || size % 2 !== 0) throw new Error('bitString#checksum: size needs to be even');

  var sumA = 0,
      sumB = 0,
      i;

  for (i = 0; i < bits.length; i++) {
    sumA = (sumA + parseInt(bits[i], 2)) % size;
    sumB = (sumB + sumA) % size;
  }

  return pad(sumB.toString(2), size / 2) + pad(sumA.toString(2), size / 2);
}
function checksum (bits, size) {
  if (bits == null || !isValid(bits)) throw new Error('bitString#checksum: Need valid bits');
  if (size == null || size % 2 !== 0) throw new Error('bitString#checksum: size needs to be even');

  var sumA = 0,
      sumB = 0,
      i;

  for (i = 0; i < bits.length; i++) {
    sumA = (sumA + parseInt(bits[i], 2)) % size;
    sumB = (sumB + sumA) % size;
  }

  return pad(sumB.toString(2), size / 2) + pad(sumA.toString(2), size / 2);
}
function checksum ( bits , size ) { if ( bits == null || ! isValid ( bits ) ) throw new Error ( 'bitString#checksum: Need valid bits' ) ; if ( size == null || size % 2 !== 0 ) throw new Error ( 'bitString#checksum: size needs to be even' ) ; var sumA = 0 , sumB = 0 , i ; for ( i = 0 ; i < bits . length ; i ++ ) { sumA = ( sumA + parseInt ( bits [ i ] , 2 ) ) % size ; sumB = ( sumB + sumA ) % size ; } return pad ( sumB . toString ( 2 ) , size / 2 ) + pad ( sumA . toString ( 2 ) , size / 2 ) ; }
Fletcher's checksum on a bitstring
@param  {string} bits Bitstring to checksum
@param  {integer} size Size of checksum, must be divisible by 2
@return {string}      Return checksum as bitstring. With BA, ie sumA last;
Fletcher s checksum on a bitstring