https://github.com/zishang520/crc16
https://github.com/zishang520/crc16
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zishang520/crc16
- Owner: zishang520
- Created: 2022-03-16T03:23:54.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-16T04:19:51.000Z (over 3 years ago)
- Last Synced: 2025-02-01T19:45:09.831Z (9 months ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CRC16
Default support: `ccittfalse`, `arc`, `augccitt`, `buypass`, `cdma2000`, `dds110`, `dectr`, `dectx`, `dnp`, `en13757`, `genibus`, `maxim`, `mcrf4xx`, `riello`, `t10dif`, `teledisk`, `tms37157`, `usb`, `a`, `kermit`, `modbus`, `x25`, `xmodem`
### Installation package
```bash
composer require luoyy/crc16
```
### Quick Sample Usage
```php
/**
* DEMO
*/
use luoyy\Crc16\Crc16;
var_dump(Crc16::make(Crc16::HEX, 'ABCD', Crc16::MODBUS));
var_dump(Crc16::dechex(Crc16::make(Crc16::HEX, 'ABCD', Crc16::MODBUS), true)); // The little-endian byte order used by the C language by default.
var_dump(Crc16::make(Crc16::STRING, 'ABCD', Crc16::A));
// If you need custom polynomial:
var_dump(Crc16::string('test', 0x0001, 0x0001, 0x0001, false, false));
var_dump(Crc16::hex('ABCD', 0x0001, 0x0001, 0x0001, false, false));
// Next, use your abilities.
```