Longitudinal Redundancy Check used in serial communications, as specified for Modbus ASCII. Sums all bytes modulo 256 and takes the two’s complement. Verification: sum of all data bytes plus LRC equals zero (modulo 256).
| Property | Value |
|---|---|
| Category | Checksums |
| Sub-category | Redundancy Check |
| Security status | 🎓 Educational Only |
| Complexity | Beginner |
| Inventor | Unknown (telecommunications standard) |
| Year | 1960 |
| Origin | Not specified |
| Source | algorithms/checksum/lrc.js |
Status: 🎓 Educational Only
No vulnerabilities are recorded for this implementation.
2 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.
Vector 1 — Wikipedia LRC worked example - STX 0 0 1 # ETX
| Field | Value |
|---|---|
input |
023030312303 |
expected |
47 |
Vector 2 — minimalmodbus known value - ‘ABCDE’
| Field | Value |
|---|---|
input |
4142434445 |
expected |
b1 |