aboutsummaryrefslogtreecommitdiffstats
path: root/src/crc16.zig
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2021-05-24 14:36:56 +0200
committerLibravatar Rutger Broekhoff2021-05-24 14:36:56 +0200
commitd301b753bfffb9ad1790c08dbab8c33b815b7e4c (patch)
tree5083fc9d163608d0010769bf190f658ff5c6f239 /src/crc16.zig
parent6e738a7b690649230c8652794b1c207743eb7f9b (diff)
downloadzig-nkeys-d301b753bfffb9ad1790c08dbab8c33b815b7e4c.tar.gz
zig-nkeys-d301b753bfffb9ad1790c08dbab8c33b815b7e4c.zip
Clean up more
Clean up unnecessary error unions, generate allowed characters table for credentials file sections at compile time.
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 b00c795..2c49500 100644
--- a/src/crc16.zig
+++ b/src/crc16.zig
@@ -1,4 +1,4 @@
1const Error = error{InvalidChecksum}; 1pub const InvalidChecksumError = error{InvalidChecksum};
2 2
3const crc16tab: [256]u16 = tab: { 3const crc16tab: [256]u16 = tab: {
4 @setEvalBranchQuota(10000); 4 @setEvalBranchQuota(10000);
@@ -36,6 +36,6 @@ pub fn make(data: []const u8) u16 {
36} 36}
37 37
38// validate will check the calculated CRC16 checksum for data against the expected. 38// validate will check the calculated CRC16 checksum for data against the expected.
39pub fn validate(data: []const u8, expected: u16) !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}