Currently, we only have CalculateChecksum function, which takes a frame (so just []byte - a byte slice) as a parameter and returns a simple, 1 byte CRC checksum. The important thing is that it ignores the last byte in that byte slice - which makes it a bit inconvenient when we want to simply calculate a CRC of some byte slice whose last byte is not necessarily a CRC checksum.
I'm suggesting:
- renaming current
CalculateChecksum function to CalculateFrameCRC
- creating a new
CalculateCRC function which works the same way as CalculateFrameCRC but also takes the last byte into account.
Another option is abandoning the current behavior (i.e ignoring the last byte) and just leaving CalculateCRC, which takes all bytes into account.
This will be a breaking change, so we will have to bump the current version to v2.0.0. I want to make the API as easy & obvious to use as possible, while also making it powerful.
cc: @TK-A369
PS In Go, "byte slice" is kind of an array. You can think of "byte slice" as a "byte array" in C.
Currently, we only have
CalculateChecksumfunction, which takes a frame (so just[]byte- a byte slice) as a parameter and returns a simple, 1 byte CRC checksum. The important thing is that it ignores the last byte in that byte slice - which makes it a bit inconvenient when we want to simply calculate a CRC of some byte slice whose last byte is not necessarily a CRC checksum.I'm suggesting:
CalculateChecksumfunction toCalculateFrameCRCCalculateCRCfunction which works the same way asCalculateFrameCRCbut also takes the last byte into account.Another option is abandoning the current behavior (i.e ignoring the last byte) and just leaving
CalculateCRC, which takes all bytes into account.This will be a breaking change, so we will have to bump the current version to
v2.0.0. I want to make the API as easy & obvious to use as possible, while also making it powerful.cc: @TK-A369
PS In Go, "byte slice" is kind of an array. You can think of "byte slice" as a "byte array" in C.