aboutsummaryrefslogtreecommitdiffstats
path: root/src/crc16.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/crc16.zig')
-rw-r--r--src/crc16.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/crc16.zig b/src/crc16.zig
index b69dcbc..3ea5a15 100644
--- a/src/crc16.zig
+++ b/src/crc16.zig
@@ -30,12 +30,12 @@ pub fn update(crc: u16, with_data: []const u8) u16 {
30 return new_crc; 30 return new_crc;
31} 31}
32 32
33// make returns the CRC16 checksum for the data provided. 33// make returns the CRC-16 checksum for the data provided.
34pub fn make(data: []const u8) u16 { 34pub fn make(data: []const u8) u16 {
35 return update(0, data); 35 return update(0, data);
36} 36}
37 37
38// validate will check the calculated CRC16 checksum for data against the expected. 38// validate will check the calculated CRC-16 checksum for data against the expected.
39pub fn validate(data: []const u8, expected: u16) InvalidChecksumError!void { 39pub fn validate(data: []const u8, expected: u16) InvalidChecksumError!void {
40 if (make(data) != expected) return error.InvalidChecksum; 40 if (make(data) != expected) return error.InvalidChecksum;
41} 41}