CRC-16 calculation for Modbus protocol
Project description
Modbus CRC-16
CRC-16 calculation library for Modbus protocol
Installation
Install it with pip:
$ pip install modbus-crc
Or you can add it as dependency in requirements.txt file of your python application:
modbus-crc~=1.3
Usage
For signing byte package use add_crc
:
from modbus_crc import add_crc
signed_package = add_crc(b'\x00\x12\x34\xAB\xCD\xEF')
Result is b'\x00\x12\x34\xAB\xCD\xEF\xD2\xD4
. For validation signed package use check_crc
:
from modbus_crc import check_crc
if not check_crc(b'\x00\x12\x34\xAB\xCD\xEF\xD2\xD4'):
raise SomeException()
Testing
$ python -m unittest discover -v -p "tests.py"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
modbus-crc-1.3.tar.gz
(3.7 kB
view details)
File details
Details for the file modbus-crc-1.3.tar.gz
.
File metadata
- Download URL: modbus-crc-1.3.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c860d8443d9a416bb1bb45e853c6f93a0500e759204ca24c24ab3b4f942c862c |
|
MD5 | 38f6903af97b19983bd1327d1d50f6b5 |
|
BLAKE2b-256 | 11f52368f483dbcb1df7be9cc9e153c4baecbeb15c74525a2ee05e96ed0566b4 |