Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specialized checksumPrepend and checksumAppend #462

Merged
merged 6 commits into from
Oct 22, 2023

Conversation

nikiforo
Copy link
Contributor

@nikiforo nikiforo commented Apr 26, 2023

The current implementation of checksummed implies that the developer knows framing. Though, sometimes it's easier to define a codec by providing the target Codec and the parameters for the checksum, e.g. size and an algorithm. For instance, look at roundtrip undefined size, I'm not sure this logic can be easily expressed using checksummed to append the CRC.

From my POV, the construction of ChecksumPrepend in terms of checksummed is harder than it should be. IIRC, I tried to express it with Codec.exmap(_.swap)(_.swap) but it was too difficult to understand when I looked at it later.

Moreover, framing in checksummed controls not only the place of CRC value and the region of bits to compute the CRC but also what is being passed to the target. That not only defines how the CRC is computed, but also what is fed to the target, which seems to be wrong, at least by violating the SRP. Also, framing doesn't allow a user to omit bit regions for CRC computation. I encountered it when I implemented a codec with the structure | THE_CRC | REGION NOT UNDER CRC | REGION UNDER THE_CRC |

@nikiforo nikiforo changed the title DRAFT: checksum to the right checksum to the right Apr 27, 2023
@nikiforo nikiforo changed the title checksum to the right specialized checksumPrepend and checksumAppend Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants