src/Barcode/Imb.php
private function imbCrc11Fcs($codeArray)
	{
		$genpoly = 0x0F35; // generator polynomial
		$fcs = 0x07FF; // Frame Check Sequence

		// do most significant byte skipping the 2 most significant bits
		$data = hexdec($codeArray[0]) << 5;
		for ($bit = 2; $bit < 8; ++$bit) {
			if (($fcs ^ $data) & 0x400) {
				$fcs = ($fcs << 1) ^ $genpoly;
			} else {
				$fcs = ($fcs << 1);
			}
			$fcs &= 0x7FF;
			$data <<= 1;
		}
		// do rest of bytes
		for ($byte = 1; $byte < 13; ++$byte) {
			$data = hexdec($codeArray[$byte]) << 3;
			for ($bit = 0; $bit < 8; ++$bit) {
				if (($fcs ^ $data) & 0x400) {
					$fcs = ($fcs << 1) ^ $genpoly;
				} else {
					$fcs = ($fcs << 1);
				}
				$fcs &= 0x7FF;
				$data <<= 1;
			}
		}
		return $fcs;
	}
private function imbCrc11Fcs($codeArray)
	{
		$genpoly = 0x0F35; // generator polynomial
		$fcs = 0x07FF; // Frame Check Sequence

		// do most significant byte skipping the 2 most significant bits
		$data = hexdec($codeArray[0]) << 5;
		for ($bit = 2; $bit < 8; ++$bit) {
			if (($fcs ^ $data) & 0x400) {
				$fcs = ($fcs << 1) ^ $genpoly;
			} else {
				$fcs = ($fcs << 1);
			}
			$fcs &= 0x7FF;
			$data <<= 1;
		}
		// do rest of bytes
		for ($byte = 1; $byte < 13; ++$byte) {
			$data = hexdec($codeArray[$byte]) << 3;
			for ($bit = 0; $bit < 8; ++$bit) {
				if (($fcs ^ $data) & 0x400) {
					$fcs = ($fcs << 1) ^ $genpoly;
				} else {
					$fcs = ($fcs << 1);
				}
				$fcs &= 0x7FF;
				$data <<= 1;
			}
		}
		return $fcs;
	}
private function imbCrc11Fcs ( $ codeArray ) { $ genpoly = 0x0F35 ; // generator polynomial $ fcs = 0x07FF ; // Frame Check Sequence // do most significant byte skipping the 2 most significant bits $ data = hexdec ( $ codeArray [ 0 ] ) << 5 ; for ( $ bit = 2 ; $ bit < 8 ; ++ $ bit ) { if ( ( $ fcs ^ $ data ) & 0x400 ) { $ fcs = ( $ fcs << 1 ) ^ $ genpoly ; } else { $ fcs = ( $ fcs << 1 ) ; } $ fcs &= 0x7FF ; $ data <<= 1 ; } // do rest of bytes for ( $ byte = 1 ; $ byte < 13 ; ++ $ byte ) { $ data = hexdec ( $ codeArray [ $ byte ] ) << 3 ; for ( $ bit = 0 ; $ bit < 8 ; ++ $ bit ) { if ( ( $ fcs ^ $ data ) & 0x400 ) { $ fcs = ( $ fcs << 1 ) ^ $ genpoly ; } else { $ fcs = ( $ fcs << 1 ) ; } $ fcs &= 0x7FF ; $ data <<= 1 ; } } return $ fcs ; }
Intelligent Mail Barcode calculation of Frame Check Sequence

@param string[] $codeArray
@return int
Intelligent Mail Barcode calculation of Frame Check Sequence