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

Improve comment for CRC32 #331

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,12 @@ func (p *packet) marshal(doChecksum bool) ([]byte, error) {
}

if doChecksum {
// Checksum is already in BigEndian
// Using LittleEndian.PutUint32 stops it from being flipped
// golang CRC32C uses reflected input and reflected output, the
// net result of this is to have the bytes flipped compared to
// the non reflected variant that the spec expects.
//
// Use LittleEndian.PutUint32 to avoid flipping the bytes in to
// the spec compliant checksum order
binary.LittleEndian.PutUint32(raw[8:], generatePacketChecksum(raw))
}

Expand Down
Loading