PHP code example of zgldh / crc16-php
1. Go to this page and download the library: Download zgldh/crc16-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zgldh / crc16-php example snippets
use Crc16\Crc16;
$rawData = '1234567890';
$result = Crc16::IBM($rawData); // dechex($result) === 'c57a'
$result = Crc16::MAXIM($rawData); // dechex($result) === '3a85'
$result = Crc16::USB($rawData); // dechex($result) === '3df5'
$result = Crc16::MODBUS($rawData); // dechex($result) === 'c20a'
$result = Crc16::CCITT($rawData); // dechex($result) === '286b'
$result = Crc16::CCITT_FALSE($rawData); // dechex($result) === '3218'
$result = Crc16::X25($rawData); // dechex($result) === '4b13'
$result = Crc16::XMODEM($rawData); // dechex($result) === 'd321'
$result = Crc16::DNP($rawData); // dechex($result) === 'bc1b'